1 // PR c++/69023 - bitset whose name is used in constant-expression rejected
2 // Test also verifies the correct evaluation of the expressions with
4 // { dg-options "-fpermissive" }
6 #if __cplusplus >= 201103L
7 # define ASSERT(e) static_assert (e, #e)
10 do { struct S { bool: !!(e); } asrt; (void)&asrt; } while (0)
16 int x; // { dg-warning "changes meaning" }
20 int x: sizeof x; // { dg-warning "declaration" }
27 // Also exercise (not covered by c++/69023):
28 int y; // { dg-warning "changes meaning" }
32 y = sizeof y // { dg-warning "declaration" }
35 // Verify the enumerator has the correct value.
36 void test () { ASSERT (y == sizeof (int)); }
43 enum { A = 16 }; // { dg-warning "changes meaning" }
46 #if __cplusplus >= 201103L
49 __attribute__ ((aligned (A)))
51 int A; // { dg-warning "declaration" }
53 // Verify the member has the correct alignment.
54 void test () { ASSERT (__alignof__ (this->A) == 16); }
61 enum { A = 16 }; // { dg-warning "changes meaning" }
64 int A [A]; // { dg-warning "declaration" }
66 // Verify the member has the correct alignment.
67 void test () { ASSERT (sizeof (this->A) == 16 * sizeof (int)); }
74 enum { A = 16 }; // { dg-warning "changes meaning" }
77 int A __attribute__ ((vector_size (A))); // { dg-warning "declaration" }
79 // Verify the member has the correct size.
80 void test () { ASSERT (sizeof (this->A) == 16); }