diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/init/new28.C')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/init/new28.C | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/init/new28.C b/gcc-4.9/gcc/testsuite/g++.dg/init/new28.C new file mode 100644 index 000000000..41a78be2a --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/init/new28.C @@ -0,0 +1,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; +} |