summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/pr69338.C
blob: 8b1351b93d732f239d4fee55ec8a4b9e58829b8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* { dg-do compile { target c++11 } } */
/* { dg-additional-options "-Wno-pedantic" } */

struct A { char i, a[]; };

void foo()
{
  struct A a0 = { 3, "AB" };                /* { dg-error "(non-static)|(initialization)" } */
}

struct A a1 = { 3, "AB" };                  /* { dg-bogus "(non-static)|(initialization)" } */

struct A a2 = (struct A){ 3, "AB" };        /* { dg-error "(non-static)|(initialization)" } */

struct B1 {
    A a3;
    B1 (): a3 { 3, "AB" } { }               /* { dg-error "(non-static)|(initialization)" } */
} b1;

struct B2 {
    A a4;
    B2 (): a4 ((struct A){ 3, "AB" }) { }   /* { dg-error "(non-static)|(initialization)" } */
} b2;