summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/init/new29.C
blob: 1ca8ca06abffae36f73e8302426d74ff6dbc1e60 (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
28
29
30
31
32
33
// PR c++/43951
// { dg-do run }
// { dg-options "-O2" }

extern "C" void abort ();

class Foo
{
public:
  Foo () : xxx (1) {};
  const int xxx;
};

struct Foo2
{
  Foo foo;
};

Foo2 *
bar ()
{
  return new Foo2;
}

int
main ()
{
  Foo2 *p = bar ();

  if (p->foo.xxx != 1)
    abort ();
  return 0;
}