• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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++03, c++11, c++14, c++17
11 
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 
main(int,char **)19 int 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     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@array:* {{calling a private constructor}}
32     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@array:* {{calling a private constructor}}
39     std::to_array(std::move(cmo)); // expected-note {{requested here}}
40   }
41 
42   return 0;
43 }
44