comparison gcc/testsuite/g++.dg/cpp0x/desig1.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 // PR c++/58882 1 // PR c++/58882
2 // { dg-do compile { target c++11 } } 2 // { dg-do compile { target c++11 } }
3 // { dg-options "-pedantic" }
3 4
4 struct A 5 struct A
5 { 6 {
6 constexpr operator int() const { return 0; } 7 constexpr operator int() const { return 0; }
7 }; 8 };
8 9
9 int a[] = { [A()] = 0 }; 10 int a[] = { [A()] = 0 }; // { dg-warning "does not allow C99 designated initializers" }
10 11
11 enum E { e0 }; 12 enum E { e0 };
12 13
13 struct B 14 struct B
14 { 15 {
15 constexpr operator E() const { return E::e0; } 16 constexpr operator E() const { return E::e0; }
16 }; 17 };
17 18
18 int b[] = { [B()] = 0 }; 19 int b[] = { [B()] = 0 }; // { dg-warning "does not allow C99 designated initializers" }
19 20
20 enum class SE { se0 }; 21 enum class SE { se0 };
21 22
22 struct C 23 struct C
23 { 24 {
24 constexpr operator SE() const { return SE::se0; } 25 constexpr operator SE() const { return SE::se0; }
25 }; 26 };
26 27
27 int c[] = { [C()] = 0 }; // { dg-error "integral constant-expression" } 28 int c[] = { [C()] = 0 }; // { dg-error "integral constant-expression" }
29 // { dg-warning "does not allow C99 designated initializers" "" { target *-*-* } .-1 }