Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/cpp1z/decomp3.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
8 | 8 |
9 void | 9 void |
10 test (A &b, B c) | 10 test (A &b, B c) |
11 { | 11 { |
12 int && [ d ] = c; // { dg-error "structured binding declaration cannot have type 'int'" } | 12 int && [ d ] = c; // { dg-error "structured binding declaration cannot have type 'int'" } |
13 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 13 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
14 char & [ e, f, ff ] { b }; // { dg-error "structured binding declaration cannot have type 'char'" } | 14 char & [ e, f, ff ] { b }; // { dg-error "structured binding declaration cannot have type 'char'" } |
15 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 15 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
16 auto&[g,h,i]=b; // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } } | 16 auto&[g,h,i]=b; // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } } |
17 decltype (auto) [ j ] = c; // { dg-error "structured binding declaration cannot have type 'decltype.auto.'" "" { target c++14 } } | 17 decltype (auto) [ j ] = c; // { dg-error "structured binding declaration cannot have type 'decltype.auto.'" "" { target c++14 } } |
18 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 18 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
19 // { dg-error "expected primary-expression before 'decltype'" "" { target c++11_down } .-2 } | 19 // { dg-error "expected primary-expression before 'decltype'" "" { target c++11_down } .-2 } |
20 auto & & && & [ m, n, o ] = b; // { dg-error "multiple ref-qualifiers" } | 20 auto & & && & [ m, n, o ] = b; // { dg-error "multiple ref-qualifiers" } |
21 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 21 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
22 constexpr auto [ p ] = c; // { dg-error "structured binding declaration cannot be 'constexpr'" } | 22 constexpr auto [ p ] = c; // { dg-error "structured binding declaration cannot be 'constexpr'" } |
23 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 23 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
24 friend auto [ q ] = c; // { dg-error "'friend' used outside of class" } | 24 friend auto [ q ] = c; // { dg-error "'friend' used outside of class" } |
25 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 25 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
26 typedef auto [ r ] = c; // { dg-error "structured binding declaration cannot be 'typedef'" } | 26 typedef auto [ r ] = c; // { dg-error "structured binding declaration cannot be 'typedef'" } |
27 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 27 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
28 inline auto [ s ] = c; // { dg-error "structured binding declaration cannot be 'inline'" } | 28 inline auto [ s ] = c; // { dg-error "structured binding declaration cannot be 'inline'" } |
29 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 29 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
30 __restrict auto [ t ] = c; // { dg-error "invalid use of 'restrict'" } | 30 __restrict auto [ t ] = c; // { dg-error "invalid use of 'restrict'" } |
31 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 31 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
32 long long auto [ u ] = c; // { dg-error "'long long' specified with 'auto'" } | 32 long long auto [ u ] = c; // { dg-error "'long long' specified with 'auto'" } |
33 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 33 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
34 virtual auto [ v ] = c; // { dg-error "'virtual' outside class declaration" } | 34 virtual auto [ v ] = c; // { dg-error "'virtual' outside class declaration" } |
35 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 35 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
36 explicit auto [ w ] = c; // { dg-error "'explicit' outside class declaration" } | 36 explicit auto [ w ] = c; // { dg-error "'explicit' outside class declaration" } |
37 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 37 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
38 static auto [ x ] = c; // { dg-error "structured binding declaration cannot be 'static'" } | 38 static auto [ x ] = c; // { dg-warning "structured binding declaration can be 'static' only in" "" { target c++17_down } } |
39 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 39 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
40 extern auto [ y ] { c }; // { dg-error "structured binding declaration cannot be 'extern'" } | 40 extern auto [ y ] { c }; // { dg-error "structured binding declaration cannot be 'extern'" } |
41 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 41 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
42 thread_local auto [ z ] = c; // { dg-warning "structured binding declaration can be 'thread_local' only in" "" { target c++17_down } } | |
43 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } | |
42 } | 44 } |
45 | |
46 __thread auto [ z2 ] = B (); // { dg-warning "structured binding declaration can be '__thread' only in" "" { target c++17_down } } | |
47 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } | |
43 | 48 |
44 void | 49 void |
45 test2 (auto & [ p ] = bar ()) // { dg-error "'p' was not declared in this scope" } | 50 test2 (auto & [ p ] = bar ()) // { dg-error "'p' was not declared in this scope" } |
46 { // { dg-warning "auto" "" { target { ! concepts } } .-1 } | 51 { // { dg-warning "auto" "" { target { ! concepts } } .-1 } |
47 } | 52 } |
51 void | 56 void |
52 test3 (A &b, B c) | 57 test3 (A &b, B c) |
53 { | 58 { |
54 auto [ d, e, f ] = arr; // { dg-error "only 3 names provided" } | 59 auto [ d, e, f ] = arr; // { dg-error "only 3 names provided" } |
55 // { dg-message "while 'int .4.' decomposes into 4 elements" "" { target *-*-* } .-1 } | 60 // { dg-message "while 'int .4.' decomposes into 4 elements" "" { target *-*-* } .-1 } |
56 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-2 } | 61 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-2 } |
57 auto & [ g, h, i, j, k ] = arr; // { dg-error "5 names provided" } | 62 auto & [ g, h, i, j, k ] = arr; // { dg-error "5 names provided" } |
58 // { dg-message "while 'int .4.' decomposes into 4 elements" "" { target *-*-* } .-1 } | 63 // { dg-message "while 'int .4.' decomposes into 4 elements" "" { target *-*-* } .-1 } |
59 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-2 } | 64 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-2 } |
60 auto [ l, m ] = b; // { dg-error "only 2 names provided" } | 65 auto [ l, m ] = b; // { dg-error "only 2 names provided" } |
61 // { dg-message "while 'A' decomposes into 3 elements" "" { target *-*-* } .-1 } | 66 // { dg-message "while 'A' decomposes into 3 elements" "" { target *-*-* } .-1 } |
62 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-2 } | 67 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-2 } |
63 auto & [ n, o, p, q ] = b; // { dg-error "4 names provided" } | 68 auto & [ n, o, p, q ] = b; // { dg-error "4 names provided" } |
64 // { dg-message "while 'A' decomposes into 3 elements" "" { target *-*-* } .-1 } | 69 // { dg-message "while 'A' decomposes into 3 elements" "" { target *-*-* } .-1 } |
65 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-2 } | 70 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-2 } |
66 auto [] { c }; // { dg-error "empty structured binding declaration" } | 71 auto [] { c }; // { dg-error "empty structured binding declaration" } |
67 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 } | 72 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 } |
68 auto [ r, s ] = c; // { dg-error "2 names provided" } | 73 auto [ r, s ] = c; // { dg-error "2 names provided" } |
69 // { dg-message "while 'B' decomposes into 1 element" "" { target *-*-* } .-1 } | 74 // { dg-message "while 'B' decomposes into 1 element" "" { target *-*-* } .-1 } |
70 // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-2 } | 75 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-2 } |
71 } | 76 } |