111
|
1 // { dg-do compile { target c++11 } }
|
|
2 // { dg-additional-options "-Wno-error=pedantic" }
|
|
3
|
|
4 #define INTB (__SIZEOF_INT__ * __CHAR_BIT__)
|
|
5 struct S { int i : INTB * 3 / 4; S (); };
|
|
6 struct T : public S { int j : INTB / 4; T (); };
|
|
7 struct U { int i : INTB * 3 / 4; int j : INTB / 4; };
|
|
8 struct V { int i : INTB * 3 / 4; int j : INTB / 4 + 1; };
|
|
9 struct W {};
|
|
10 struct X : public W { int i; void bar (); };
|
|
11 struct Y {
|
145
|
12 char a[3]; char b[]; // { dg-warning "19:ISO C\\+\\+ forbids flexible array member" }
|
111
|
13 };
|
|
14 struct Z { int a; float b; };
|
|
15 struct A { int i : INTB * 2; int j; }; // { dg-warning "exceeds its type" }
|
|
16 union B { long a; unsigned long b; };
|
|
17 union C { int a; int b : INTB - 1; };
|
|
18 struct D { int a : INTB + 1; int b : INTB - 1; }; // { dg-warning "exceeds its type" }
|
|
19 static_assert (__has_unique_object_representations (char) == true, "");
|
|
20 static_assert (__has_unique_object_representations (unsigned char) == true, "");
|
|
21 static_assert (__has_unique_object_representations (int) == true, "");
|
|
22 static_assert (__has_unique_object_representations (unsigned int) == true, "");
|
|
23 static_assert (__has_unique_object_representations (bool) == true, "");
|
|
24 static_assert (sizeof (S) != sizeof (int) || __has_unique_object_representations (S) == false, "");
|
|
25 static_assert (sizeof (T) != sizeof (int) || __has_unique_object_representations (T) == true, "");
|
|
26 static_assert (sizeof (U) != sizeof (int) || __has_unique_object_representations (U) == true, "");
|
|
27 static_assert (__has_unique_object_representations (V) == false, "");
|
|
28 static_assert (__has_unique_object_representations (W) == false, "");
|
|
29 static_assert (sizeof (X) != sizeof (int) || __has_unique_object_representations (X) == true, "");
|
|
30 static_assert (__has_unique_object_representations (float) == false, "");
|
|
31 static_assert (__has_unique_object_representations (double) == false, "");
|
|
32 static_assert (__has_unique_object_representations (long double) == false, "");
|
|
33 static_assert (__has_unique_object_representations (void) == false, "");
|
|
34 static_assert (__has_unique_object_representations (_Complex int) == true, "");
|
|
35 static_assert (__has_unique_object_representations (_Complex float) == false, "");
|
|
36 static_assert (__has_unique_object_representations (_Complex double) == false, "");
|
|
37 static_assert (__has_unique_object_representations (_Complex long double) == false, "");
|
|
38 static_assert (__has_unique_object_representations (int __attribute__((vector_size (16)))) == true, "");
|
|
39 static_assert (__has_unique_object_representations (float __attribute__((vector_size (16)))) == false, "");
|
|
40 static_assert (__has_unique_object_representations (int X::*) == true, "");
|
|
41 static_assert (__has_unique_object_representations (void (X::*) ()) == true, "");
|
|
42 static_assert (__has_unique_object_representations (int *) == true, "");
|
|
43 static_assert (__has_unique_object_representations (int (*) ()) == true, "");
|
|
44 static_assert (__has_unique_object_representations (decltype (nullptr)) == false, "");
|
|
45 static_assert (__has_unique_object_representations (Y) == (sizeof (Y) == 3 * sizeof (char)), "");
|
|
46 static_assert (__has_unique_object_representations (Z) == false, "");
|
|
47 static_assert (__has_unique_object_representations (A) == false, "");
|
|
48 static_assert (sizeof (B) != sizeof (long) || __has_unique_object_representations (B) == true, "");
|
|
49 static_assert (__has_unique_object_representations (C) == false, "");
|
|
50 static_assert (__has_unique_object_representations (D) == false, "");
|