Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/constexpr-89074-1.C

raw
1 // PR c++/89074
2 // { dg-do compile { target c++17 } }
3
4 struct S { int s; };
5 struct T : public S { };
6 struct U : public T { };
7
8 constexpr bool
9 foo ()
10 {
11 U a[] = { 1, 2, 3, 4 };
12 U b[] = { 5, 6, 7, 8 };
13 T *c = (T *) a + 1;
14 S *d = (S *) c + 2;
15 S *e = (S *) b + 1;
16
17 if (a + 0 == b + 0)
18 return false;
19
20 if (d == e)
21 return false;
22
23 return true;
24 }
25
26 static_assert (foo (), "");