Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / desig1.C
blobdd9ad5db5a358c46b0dbd61e0a6002bf73cc1849
1 // PR c++/58882
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-pedantic" }
5 struct A
7   constexpr operator int() const { return 0; }
8 };
10 int a[] = { [A()] = 0 };        // { dg-warning "does not allow C99 designated initializers" }
12 enum E { e0 };
14 struct B
16   constexpr operator E() const { return E::e0; }
19 int b[] = { [B()] = 0 };        // { dg-warning "does not allow C99 designated initializers" }
21 enum class SE { se0 };
23 struct C
25   constexpr operator SE() const { return SE::se0; }
28 int c[] = { [C()] = 0 }; // { dg-error "14:C99 designator .C\\\(\\\). is not an integral constant-expression" }
29                          // { dg-warning "does not allow C99 designated initializers" "" { target *-*-* } .-1 }