diff mbox

[C++] PR 67845

Message ID 5631FCD9.30402@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Oct. 29, 2015, 11:02 a.m. UTC
Hi,

adjusting at the same time TREE_TYPE of the already built decl, avoids 
ICEing during error recovery in merge_types for this kind of snippet. 
Tested x86_64-linux.

Thanks,
Paolo.

////////////////////////////
/cp
2015-10-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/67845
	* decl.c (grokfndecl): In case of erroneous cv-qualified non-member
	functions consistently reset TREE_TYPE (decl) too.

/testsuite
2015-10-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/67845
	* g++.dg/other/cv_func4.C: New.

Comments

Jason Merrill Oct. 29, 2015, 12:32 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 229518)
+++ cp/decl.c	(working copy)
@@ -7998,6 +7998,11 @@  grokfndecl (tree ctype,
   DECL_EXTERNAL (decl) = 1;
   if (TREE_CODE (type) == FUNCTION_TYPE)
     {
+      if (quals || rqual)
+	TREE_TYPE (decl) = apply_memfn_quals (TREE_TYPE (decl),
+					      TYPE_UNQUALIFIED,
+					      REF_QUAL_NONE);
+
       if (quals)
 	{
 	  error (ctype
Index: testsuite/g++.dg/other/cv_func4.C
===================================================================
--- testsuite/g++.dg/other/cv_func4.C	(revision 0)
+++ testsuite/g++.dg/other/cv_func4.C	(working copy)
@@ -0,0 +1,6 @@ 
+// PR c++/67845
+
+typedef void F () const;
+
+F foo;  // { dg-error "cv-qualifier" }
+void foo ();