summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/constexpr-array22.C
blob: 80e24e2d6971e9b945b615c8e9899e41cbb148b2 (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
27
// PR c++/93143
// { dg-do run { target c++11 } }

struct A { char a[2]; };

static constexpr A foo () { return A{1}; }

void bar ()
{
  A a = foo ();
  if (a.a[0] != 1)
    __builtin_abort(); 
}

void foobar ()
{
  A x[] = { foo (), foo () };
  A a = foo ();
  if (a.a[0] != 1)
    __builtin_abort(); 
}

int main()
{
  bar();
  foobar();
}