re PR c++/35327 (ICE with invalid constructor)
authorPaolo Carlini <paolo.carlini@oracle.com>
Sat, 7 Jun 2008 08:06:46 +0000 (08:06 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 7 Jun 2008 08:06:46 +0000 (08:06 +0000)
/cp
2008-06-07  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/35327
        * decl.c (grokdeclarator): In case of wrong return type return
immediately error_mark_node.

/testsuite
2008-06-07  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/35327
        * g++.dg/parse/crash41.C: New.

From-SVN: r136518

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/crash41.C [new file with mode: 0644]

index 936db240b429eed4f7613e9672bc92c7f0be13dd..fb79f4770c51a42988ca2a9b81d09b990a989807 100644 (file)
@@ -1,3 +1,9 @@
+2008-06-07  Paolo Carlini  <paolo.carlini@oracle.com>
+
+        PR c++/35327
+        * decl.c (grokdeclarator): In case of wrong return type return
+       immediately error_mark_node.
+
 2008-06-06  Jakub Jelinek  <jakub@redhat.com>
 
        * cp-tree.h (cxx_omp_finish_clause, cxx_omp_create_clause_info,
index 8056518e746b7a440edc132635f01209bcf80448..f97039bfa2f66d779d2671dfd349d7c207b5f405 100644 (file)
@@ -8088,17 +8088,17 @@ grokdeclarator (const cp_declarator *declarator,
                set_no_warning = true;
              }
 
-           /* Warn about some types functions can't return.  */
+           /* Error about some types functions can't return.  */
 
            if (TREE_CODE (type) == FUNCTION_TYPE)
              {
                error ("%qs declared as function returning a function", name);
-               type = integer_type_node;
+               return error_mark_node;
              }
            if (TREE_CODE (type) == ARRAY_TYPE)
              {
                error ("%qs declared as function returning an array", name);
-               type = integer_type_node;
+               return error_mark_node;
              }
 
            /* Pick up type qualifiers which should be applied to `this'.  */
index a1ce73c2761340fa3b2000dc4ffb5eaf66f53653..40e8b5169ce07c23b51c5869d03f1da108dbf3e8 100644 (file)
@@ -1,3 +1,8 @@
+2008-06-07  Paolo Carlini  <paolo.carlini@oracle.com>
+
+        PR c++/35327
+        * g++.dg/parse/crash41.C: New.
+
 2008-06-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/36362
diff --git a/gcc/testsuite/g++.dg/parse/crash41.C b/gcc/testsuite/g++.dg/parse/crash41.C
new file mode 100644 (file)
index 0000000..746dbbc
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/35327
+
+struct A
+{
+  A(int)(); // { dg-error "declared" }
+};
+
+template<int> void foo(bool b, A a) { b ? a : 0; } // { dg-error "no match" }