/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 7 Jun 2008 08:06:46 +0000 (08:06 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 7 Jun 2008 08:06:46 +0000 (08:06 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136518 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 936db24..fb79f47 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 8056518..f97039b 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 a1ce73c..40e8b51 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" }