aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2008-06-07 08:06:46 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2008-06-07 08:06:46 +0000
commite32764576e31e938e1257dd55e5c151db7a87e9e (patch)
treebdedfd66d3d07c0bc9326eea90856e559cac7e31 /gcc
parent968c8001a2f049c533f1b00fc0f7c31a0b11015e (diff)
downloadgcc-e32764576e31e938e1257dd55e5c151db7a87e9e.zip
gcc-e32764576e31e938e1257dd55e5c151db7a87e9e.tar.gz
gcc-e32764576e31e938e1257dd55e5c151db7a87e9e.tar.bz2
re PR c++/35327 (ICE with invalid constructor)
/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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/crash41.C8
4 files changed, 22 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 936db24..fb79f47 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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,
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 8056518..f97039b 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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'. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a1ce73c..40e8b51 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..746dbbc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/crash41.C
@@ -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" }