summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
authordgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-31 19:18:20 +0000
committerdgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-31 19:18:20 +0000
commit2d7f50b974d8f7228a53ce8c52eb2aae2ff79baf (patch)
tree2f99d34ff51b2a0d4c2f5bf980a91ec2f1f8397d /gcc/testsuite/g++.dg
parentc4692e0443adc1dad6b7ff91f324b3e2af4f6b12 (diff)
downloadgcc-2d7f50b974d8f7228a53ce8c52eb2aae2ff79baf.tar.gz
2007-08-31 Douglas Gregor <doug.gregor@gmail.com>
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 <doug.gregor@gmail.com> 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
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-new.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-new2.C24
2 files changed, 43 insertions, 0 deletions
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 <assert.h>
+#include <new>
+
+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 <assert.h>
+#include <new>
+
+template< class... Args > void f( Args... args )
+{
+ {
+ int x = 17;
+ (void)x;
+ }
+
+ {
+ int y(args...);
+ assert(y == 0);
+ }
+
+}
+
+int main()
+{
+ f();
+}