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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <array>
10 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
11 
12 #include <array>
13 
14 #include "test_macros.h"
15 #include "MoveOnly.h"
16 
17 int main(int, char**) {
18   {
19     char source[3][6] = {"hi", "world"};
20     // expected-error@array:* {{to_array does not accept multidimensional arrays}}
21     // expected-error@array:* {{to_array requires copy constructible elements}}
22     // expected-error@array:* 3 {{cannot initialize}}
23     std::to_array(source); // expected-note {{requested here}}
24   }
25 
26   {
27     MoveOnly mo[] = {MoveOnly{3}};
28     // expected-error@array:* {{to_array requires copy constructible elements}}
29     // expected-error@array:* {{calling a private constructor}}
30     std::to_array(mo); // expected-note {{requested here}}
31   }
32 
33   {
34     const MoveOnly cmo[] = {MoveOnly{3}};
35     // expected-error@array:* {{to_array requires move constructible elements}}
36     // expected-error@array:* {{calling a private constructor}}
37     std::to_array(std::move(cmo)); // expected-note {{requested here}}
38   }
39 
40   return 0;
41 }
42