gcc/testsuite/g++.dg/warn/Wuninitialized-26.C
raw| 1 | // PR c++/19808 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | // { dg-options "-Wuninitialized" } |
| 4 | // Anonymous union/struct. |
| 5 | // ??? The diagnostic should be improved to say 'b' instead of |
| 6 | // "<anonymous>". |
| 7 | |
| 8 | struct S { |
| 9 | __extension__ struct { |
| 10 | int a; |
| 11 | int b; |
| 12 | }; |
| 13 | S() : a(b) { } // { dg-warning "is used uninitialized" } |
| 14 | }; |
| 15 | |
| 16 | struct U { |
| 17 | union { |
| 18 | int a; |
| 19 | int b; |
| 20 | }; |
| 21 | U() : a(b) { } // { dg-warning "is used uninitialized" } |
| 22 | }; |