re PR c++/27423 (ICE on default argument for void parameter)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Sat, 6 May 2006 00:32:27 +0000 (00:32 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Sat, 6 May 2006 00:32:27 +0000 (00:32 +0000)
PR c++/27423
* typeck.c (convert_for_initialization): Skip erroneous types.

* g++.dg/other/void2.C: New test.

From-SVN: r113571

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/void2.C [new file with mode: 0644]

index c24ed2aaeeccbfbfa1810bb2abb375972d90c118..31e40dedf6a4c00d602eecd2a466b9ce831b0f4a 100644 (file)
@@ -1,5 +1,8 @@
 2006-05-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/27423
+       * typeck.c (convert_for_initialization): Skip erroneous types.
+
        PR c++/27422
        * typeck.c (convert_arguments): Return early on args with
        invalid types.
index 7d3bd3a3f82fa431623180a9bb335a7c80310de8..3eeb8375f1e380a0bf3b3d4ea58c64df74ca1baf 100644 (file)
@@ -6219,7 +6219,8 @@ convert_for_initialization (tree exp, tree type, tree rhs, int flags,
       && codel != REFERENCE_TYPE)
     rhs = TREE_OPERAND (rhs, 0);
 
-  if (rhs == error_mark_node
+  if (type == error_mark_node
+      || rhs == error_mark_node
       || (TREE_CODE (rhs) == TREE_LIST && TREE_VALUE (rhs) == error_mark_node))
     return error_mark_node;
 
index 500e64aa95080f1d15afa1f394705066cef621a0..a51b52d0882785487dba8e6dde74746e71149b26 100644 (file)
@@ -1,5 +1,8 @@
 2006-05-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/27423
+       * g++.dg/other/void2.C: New test.
+
        PR c++/27422
        * g++.dg/conversion/void1.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/other/void2.C b/gcc/testsuite/g++.dg/other/void2.C
new file mode 100644 (file)
index 0000000..153e0f1
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/27423
+// { dg-do compile }
+
+void foo(void = 0);    // { dg-error "incomplete type|invalid use" }
+void bar() { foo(); }