aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/constexpr-89074-1.C
blob: ca91765ab202740f0e3ec611930610e9e17d28df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// PR c++/89074
// { dg-do compile { target c++17 } }

struct S { int s; };
struct T : public S { };
struct U : public T { };

constexpr bool
foo ()
{
  U a[] = { 1, 2, 3, 4 };
  U b[] = { 5, 6, 7, 8 };
  T *c = (T *) a + 1;
  S *d = (S *) c + 2;
  S *e = (S *) b + 1;

  if (a + 0 == b + 0)
    return false;

  if (d == e)
    return false;

  return true;
}

static_assert (foo (), "");