diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/Wcxx-compat-20.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/Wcxx-compat-20.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-20.c b/gcc/testsuite/gcc.dg/Wcxx-compat-20.c new file mode 100644 index 000000000..af774acc8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wcxx-compat-20.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-Wc++-compat" } */ +typedef struct s { const int i; } s; /* { dg-message "should be initialized" } */ +union u {const int a; double b;}; /* { dg-message "should be initialized" } */ +struct ts { int a; s v;}; +struct ta { int a; s v[2];}; + +void f () +{ + s v1; /* { dg-warning "uninitialized const member in" } */ + s va[2]; /* { dg-warning "uninitialized const member in" } */ + union u v2; /* { dg-warning "uninitialized const member in" } */ + struct ts v3; /* { dg-warning "uninitialized const member in" } */ + struct ta ta[2]; /* { dg-warning "uninitialized const member in" } */ +} |