diff mbox

[C++] PR 50309

Message ID 4E674980.8080006@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Sept. 7, 2011, 10:37 a.m. UTC
Hi,

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?

Thanks,
Paolo.

////////////////
/cp
2011-09-07  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50309
	* decl.c (grokdeclarator): Check u.function.exception_specification
	for error_mark_node.

/testsuite
2011-09-07  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50309
	* g++.dg/cpp0x/noexcept14.C: New.

Comments

Jason Merrill Sept. 7, 2011, 4:41 p.m. UTC | #1
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
diff mbox

Patch

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.  */