44 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// <array>10// UNSUPPORTED: c++03, c++11, c++14, c++1711 12#include <array>13 14#include "test_macros.h"15#include "MoveOnly.h"16 17// expected-warning@array:* 0-1 {{suggest braces around initialization of subobject}}18 19int main(int, char**) {20 {21 char source[3][6] = {"hi", "world"};22 // expected-error@array:* {{to_array does not accept multidimensional arrays}}23 // expected-error@array:* {{to_array requires copy constructible elements}}24 // expected-error@array:* 3 {{cannot initialize}}25 (void)std::to_array(source); // expected-note {{requested here}}26 }27 28 {29 MoveOnly mo[] = {MoveOnly{3}};30 // expected-error@array:* {{to_array requires copy constructible elements}}31 // expected-error-re@array:* 1-2{{{{(call to implicitly-deleted copy constructor of 'MoveOnly')|(call to deleted constructor of 'MoveOnly')}}}}32 (void)std::to_array(mo); // expected-note {{requested here}}33 }34 35 {36 const MoveOnly cmo[] = {MoveOnly{3}};37 // expected-error@array:* {{to_array requires move constructible elements}}38 // expected-error-re@array:* 0-1{{{{(call to implicitly-deleted copy constructor of 'MoveOnly')|(call to deleted constructor of 'MoveOnly')}}}}39 (void)std::to_array(std::move(cmo)); // expected-note {{requested here}}40 }41 42 return 0;43}44