From: Paolo Carlini Date: Sat, 7 Jun 2008 08:06:46 +0000 (+0000) Subject: re PR c++/35327 (ICE with invalid constructor) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e32764576e31e938e1257dd55e5c151db7a87e9e;p=gcc.git re PR c++/35327 (ICE with invalid constructor) /cp 2008-06-07 Paolo Carlini PR c++/35327 * decl.c (grokdeclarator): In case of wrong return type return immediately error_mark_node. /testsuite 2008-06-07 Paolo Carlini PR c++/35327 * g++.dg/parse/crash41.C: New. From-SVN: r136518 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 936db240b42..fb79f4770c5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-06-07 Paolo Carlini + + PR c++/35327 + * decl.c (grokdeclarator): In case of wrong return type return + immediately error_mark_node. + 2008-06-06 Jakub Jelinek * 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 8056518e746..f97039bfa2f 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 a1ce73c2761..40e8b5169ce 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-06-07 Paolo Carlini + + PR c++/35327 + * g++.dg/parse/crash41.C: New. + 2008-06-06 Jakub Jelinek 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 00000000000..746dbbca8a1 --- /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 void foo(bool b, A a) { b ? a : 0; } // { dg-error "no match" }