From 2d7f50b974d8f7228a53ce8c52eb2aae2ff79baf Mon Sep 17 00:00:00 2001 From: dgregor Date: Fri, 31 Aug 2007 19:18:20 +0000 Subject: 2007-08-31 Douglas Gregor PR c++/32597 * init.c (build_default_init): Make extern. * cp-tree.h (build_default_init): Declare here. * pt.c (tsubst_expr): When the instantiation of the initializer of a variable results in an empty list, default-initialize the variable. (tsubst_copy_and_build): When the instantiation of the initializer in a new expression results in an empty initializer list, default-initialize it. 2007-08-31 Douglas Gregor PR c++/32597 * gcc/testsuite/g++.dg/cpp0x/variadic-new2.C: New. * gcc/testsuite/g++.dg/cpp0x/variadic-new.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128000 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/g++.dg/cpp0x/variadic-new.C | 19 +++++++++++++++++++ gcc/testsuite/g++.dg/cpp0x/variadic-new2.C | 24 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-new.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-new2.C (limited to 'gcc/testsuite/g++.dg') diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-new.C b/gcc/testsuite/g++.dg/cpp0x/variadic-new.C new file mode 100644 index 00000000000..869052774cf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-new.C @@ -0,0 +1,19 @@ +// { dg-do "run" } +// { dg-options "-std=c++0x" } +// Contributed by Peter Dimov +// PR c++/32597 +#include +#include + +int k = 5; + +template< class... Args > void f( Args... args ) +{ + new( &k ) int( args... ); +} + +int main() +{ + f(); + assert( k == 0 ); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-new2.C b/gcc/testsuite/g++.dg/cpp0x/variadic-new2.C new file mode 100644 index 00000000000..a40f96e110b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-new2.C @@ -0,0 +1,24 @@ +// { dg-do "run" } +// { dg-options "-std=c++0x" } +// PR c++/32597 +#include +#include + +template< class... Args > void f( Args... args ) +{ + { + int x = 17; + (void)x; + } + + { + int y(args...); + assert(y == 0); + } + +} + +int main() +{ + f(); +} -- cgit v1.2.1