Message ID | 4E674980.8080006@oracle.com |
---|---|
State | New |
Headers | show |
On 09/07/2011 06:37 AM, Paolo Carlini wrote: > I have the below simple patch to avoid the ICE after error. Tested > x86_64-linux. Is it Ok? In case, if it applies as-is, 4_6-branch too? I think this is a recoverable error; if the exception-specification is ill-formed, let's pretend there wasn't one rather than discard the whole declaration. Jason
Index: testsuite/g++.dg/cpp0x/noexcept14.C =================================================================== --- testsuite/g++.dg/cpp0x/noexcept14.C (revision 0) +++ testsuite/g++.dg/cpp0x/noexcept14.C (revision 0) @@ -0,0 +1,4 @@ +// PR c++/50309 +// { dg-options -std=c++0x } + +void foo () noexcept () { } // { dg-error "expected" } Index: cp/decl.c =================================================================== --- cp/decl.c (revision 178631) +++ cp/decl.c (working copy) @@ -9049,6 +9049,8 @@ grokdeclarator (const cp_declarator *declarator, virt_specifiers = declarator->u.function.virt_specifiers; /* Pick up the exception specifications. */ raises = declarator->u.function.exception_specification; + if (raises == error_mark_node) + return error_mark_node; /* Say it's a definition only for the CALL_EXPR closest to the identifier. */