| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
// { dg-options "" } |
| 3 |
|
| 4 |
struct A { int f; }; |
| 5 |
struct B { int b; }; |
| 6 |
struct C : virtual A {}; |
| 7 |
struct D : virtual A {}; |
| 8 |
struct E { int f; }; |
| 9 |
struct F : A { int f; }; |
| 10 |
struct G : A, E {}; |
| 11 |
struct H : C, D {}; |
| 12 |
struct I : A, C {}; // { dg-warning "due to ambiguity" } |
| 13 |
struct J : B {}; |
| 14 |
struct K : B, virtual J {}; // { dg-warning "due to ambiguity" } |
| 15 |
struct L : virtual J {}; |
| 16 |
struct M : virtual J, L {}; |
| 17 |
|
| 18 |
void |
| 19 |
foo (C &c, F &f, G &g, H &h, I &i, K &k, M &m) |
| 20 |
{ |
| 21 |
auto [ ci ] = c; // { dg-warning "structured bindings only available with" "" { target c++14_down } } |
| 22 |
auto [ fi ] = f; // { dg-error "cannot decompose class type 'F': both it and its base class 'A' have non-static data members" } |
| 23 |
// { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } |
| 24 |
auto [ gi ] = g; // { dg-error "cannot decompose class type 'G': its base classes 'A' and 'E' have non-static data members" } |
| 25 |
// { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } |
| 26 |
auto [ hi ] = h; // { dg-warning "structured bindings only available with" "" { target c++14_down } } |
| 27 |
auto [ ki ] = k; // { dg-error "'B' is an ambiguous base of 'K'" } |
| 28 |
// { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } |
| 29 |
auto [ mi ] = m; // { dg-warning "structured bindings only available with" "" { target c++14_down } } |
| 30 |
} |