This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH for c++/51416 (ICE on invalid auto)


When there are no arguments for a parameter pack, an expansion between parens in a variable initializer reduces to value-initialization. This isn't valid for auto. Fixed by checking for incomplete type.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 380724b25cd317ea8b6434cdd1215e831ac2dcde
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Dec 16 18:31:01 2011 -0500

    	PR c++/51416
    	* init.c (build_value_init_noctor): Check for incomplete type.

diff --git a/gcc/testsuite/g++.dg/cpp0x/auto31.C b/gcc/testsuite/g++.dg/cpp0x/auto31.C
new file mode 100644
index 0000000..26a6560
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/auto31.C
@@ -0,0 +1,12 @@
+// PR c++/51416
+// { dg-do compile { target c++11 } }
+
+template<typename T, typename... U> void foo(T, U... u)
+{
+  auto foo(u...);		// { dg-error "auto" }
+}
+
+void bar()
+{
+  foo(0);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic103.C b/gcc/testsuite/g++.dg/cpp0x/variadic103.C
index 6d12331..9d6b5ea 100644
--- a/gcc/testsuite/g++.dg/cpp0x/variadic103.C
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic103.C
@@ -5,7 +5,7 @@ T&& create();
 
 template<class T, class... Args>
 void test() {
-  T t(create<Args>()...);	// { dg-error "unknown bound" }
+  T t(create<Args>()...);	// { dg-error "incomplete" }
   (void) t;
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]