annotate gcc/testsuite/g++.dg/cpp1z/has-unique-obj-representations1.C @ 145:1830386684a0

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