]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/50054 (Fails to recover from type error in function signature)
authorJason Merrill <jason@redhat.com>
Tue, 16 Aug 2011 23:25:43 +0000 (19:25 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 16 Aug 2011 23:25:43 +0000 (19:25 -0400)
PR c++/50054
* typeck2.c (cxx_incomplete_type_diagnostic): Handle
init_list_type_node.

From-SVN: r177810

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

index a18a24c262c3629dcc14c120a81d458889609d30..ea1a8d086e0f13fbcb1cf58a1a57089388b8ab9f 100644 (file)
@@ -1,3 +1,9 @@
+2011-08-16  Jason Merrill  <jason@redhat.com>
+
+       PR c++/50054
+       * typeck2.c (cxx_incomplete_type_diagnostic): Handle
+       init_list_type_node.
+
 2011-08-13  Jason Merrill  <jason@redhat.com>
 
        PR c++/50075
index 07881387eba8089f3719aa25833eee9bcc6ae29e..79aa354ad02eb3db00d038e09ebe27fc477651d7 100644 (file)
@@ -450,6 +450,12 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
       break;
 
     case LANG_TYPE:
+      if (type == init_list_type_node)
+       {
+         emit_diagnostic (diag_kind, input_location, 0,
+                          "invalid use of brace-enclosed initializer list");
+         break;
+       }
       gcc_assert (type == unknown_type_node);
       if (value && TREE_CODE (value) == COMPONENT_REF)
        goto bad_member;
index 54053b99af8bbec31bce5d9a156247e14cd941f5..2e56e745e42438ec4e93b95aa89b2cf499f7e0f8 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-16  Jason Merrill  <jason@redhat.com>
+
+       PR c++/50054
+       * g++.dg/cpp0x/initlist56.C: New.
+
 2011-08-15  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR testsuite/50085
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist57.C b/gcc/testsuite/g++.dg/cpp0x/initlist57.C
new file mode 100644 (file)
index 0000000..d945a46
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/50054
+// { dg-options -std=c++0x }
+
+void g( const int& (a)[1] ) {} // { dg-error "array of references" }
+
+int main () {
+    g( { 1, 2 } );             // { dg-error "initializer list" }
+}