annotate gcc/testsuite/g++.dg/cpp1z/decomp4.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // { dg-do compile { target c++11 } }
kono
parents:
diff changeset
2 // { dg-options "" }
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 struct A { int a; struct { int b; }; };
kono
parents:
diff changeset
5 struct B { int a; union { int c; long d; }; };
kono
parents:
diff changeset
6 struct C { int a; private: int b; };
kono
parents:
diff changeset
7 struct D { int a; private: static int b; };
kono
parents:
diff changeset
8 struct E { protected: int a; };
kono
parents:
diff changeset
9 struct F { int a; };
kono
parents:
diff changeset
10 struct G : public F { int b; };
kono
parents:
diff changeset
11 struct H { int b; };
kono
parents:
diff changeset
12 struct I : public F, H {};
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 void
kono
parents:
diff changeset
15 test (A &a, B &b, C &c, D &d, E &e, F &f, G &g, H &h, I &i)
kono
parents:
diff changeset
16 {
kono
parents:
diff changeset
17 auto [ j ] = a; // { dg-error "cannot decompose class type 'A' because it has an anonymous struct member" }
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
18 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 }
111
kono
parents:
diff changeset
19 auto [ k ] { b }; // { dg-error "cannot decompose class type 'B' because it has an anonymous union member" }
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
20 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 }
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
21 auto [ l, l2 ] = c; // { dg-error "cannot decompose inaccessible member 'C::b' of 'C'" }
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
22 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
23 auto [ m ] = d; // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } }
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
24 auto [ n ] { e }; // { dg-error "cannot decompose inaccessible member 'E::a' of 'E'" }
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
25 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
26 auto [ o ] { f }; // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } }
111
kono
parents:
diff changeset
27 auto & [ p ] { g }; // { dg-error "cannot decompose class type 'G': both it and its base class 'F' have non-static data members" }
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
28 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
29 auto [ q ] { h }; // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } }
111
kono
parents:
diff changeset
30 auto [ r ] { i }; // { dg-error "cannot decompose class type 'I': its base classes 'F' and 'H' have non-static data members" }
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
31 // { dg-warning "structured bindings only available with '-std=c..17' or '-std=gnu..17'" "" { target c++14_down } .-1 }
111
kono
parents:
diff changeset
32 }