From patchwork Tue Sep 14 14:50:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [C++] PR 45665 From: Paolo Carlini X-Patchwork-Id: 64706 Message-Id: <4C8F8BCF.2020304@oracle.com> To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill Date: Tue, 14 Sep 2010 16:50:55 +0200 Hi, I have this simple patch for an ICE on invalid. Tested x86_64-linux. Is it ok for mainline? Thanks, Paolo. ////////////////// /cp 2010-09-14 Paolo Carlini PR c++/45665 * decl.c (grokdeclarator): Check build_memfn_type return value for error_mark_node. /testsuite 2010-09-14 Paolo Carlini PR c++/45665 * testsuite/g++.dg/template/crash103.C: New. Index: testsuite/g++.dg/template/crash103.C =================================================================== --- testsuite/g++.dg/template/crash103.C (revision 0) +++ testsuite/g++.dg/template/crash103.C (revision 0) @@ -0,0 +1,4 @@ +// PR c++/45665 + +template < typename > struct S; +void (S <0>::*ptr) (); // { dg-error "type" } Index: cp/decl.c =================================================================== --- cp/decl.c (revision 164279) +++ cp/decl.c (working copy) @@ -8762,6 +8762,8 @@ grokdeclarator (const cp_declarator *declarator, type = build_memfn_type (type, declarator->u.pointer.class_type, memfn_quals); + if (type == error_mark_node) + return error_mark_node; memfn_quals = TYPE_UNQUALIFIED; }