aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/init/new28.C
blob: 41a78be2a2597d2b59f91d08998f337b92ff6cb9 (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++/43951
// { dg-do run }
// { dg-options "-O2" }

extern "C" void abort ();

class Foo 
{
public:
  Foo () : xxx (1) {};
  const int xxx;
};
Foo *
bar ()
{
  return new Foo;
}

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

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