]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/51416 ([c++0x] [4.6/4.7 Regression] ICE with invalid use of auto)
authorJason Merrill <jason@redhat.com>
Sat, 17 Dec 2011 13:52:02 +0000 (08:52 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 17 Dec 2011 13:52:02 +0000 (08:52 -0500)
PR c++/51416
* init.c (build_value_init_noctor): Check for incomplete type.

From-SVN: r182436

gcc/cp/ChangeLog
gcc/cp/init.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/auto31.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/variadic103.C

index 6260496830ccd2cbd60f1cf451468f9138e2ba45..24d2b924a93eb13338e6599d6be88e899b6bd89b 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-16  Jason Merrill  <jason@redhat.com>
+
+       PR c++/51416
+       * init.c (build_value_init_noctor): Check for incomplete type.
+
 2011-12-16  Jason Merrill  <jason@redhat.com>
 
        PR c++/51331
index 14766b648fbcaf06f0df03efc790ca69d79904d5..091ac73ae1e1772929af78c0df07b13c05a926ef 100644 (file)
@@ -370,6 +370,12 @@ build_value_init (tree type, tsubst_flags_t complain)
 tree
 build_value_init_noctor (tree type, tsubst_flags_t complain)
 {
+  if (!COMPLETE_TYPE_P (type))
+    {
+      if (complain & tf_error)
+       error ("value-initialization of incomplete type %qT", type);
+      return error_mark_node;
+    }
   if (CLASS_TYPE_P (type))
     {
       gcc_assert (!TYPE_NEEDS_CONSTRUCTING (type));
index 3bfeedb5a73a7b68ed74da4849a97f24ecba3b2a..2d37cba75c9f9a3401c1827eb2b063f4b5203363 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-16  Jason Merrill  <jason@redhat.com>
+
+       PR c++/51416
+       * g++.dg/cpp0x/auto31.C: New.
+
 2011-12-16  Jason Merrill  <jason@redhat.com>
 
        PR c++/51331
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto31.C b/gcc/testsuite/g++.dg/cpp0x/auto31.C
new file mode 100644 (file)
index 0000000..2c74b72
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/51416
+// { dg-options "-std=c++0x" }
+
+template<typename T, typename... U> void foo(T, U... u)
+{
+  auto foo(u...);              // { dg-error "auto" }
+}
+
+void bar()
+{
+  foo(0);
+}
index 6d12331d000d59f1dcee2f35fa02c9e036ae584c..9d6b5ea20b85275dc5f1038f4a3bdbae200ffad6 100644 (file)
@@ -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;
 }