This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Small C++ PATCH to grokdeclarator


I wondered why grokdeclarator was handling the case of adding a ptr-operator to a METHOD_TYPE, since there's no way in C++ to name a METHOD_TYPE directly. So I asserted that it can't happen, and nothing broke.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 852b32bc251b703a25ecd60e3c99ee5a69e642ab
Author: Jason Merrill <jason@redhat.com>
Date:   Sat Jan 26 22:36:35 2013 -0500

    	* decl.c (grokdeclarator): Assert that we won't see a pointer to
    	METHOD_TYPE.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index b67978d..facaae7 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9630,9 +9630,11 @@ grokdeclarator (const cp_declarator *declarator,
 	     but to the target of the pointer.  */
 	  type_quals = TYPE_UNQUALIFIED;
 
+	  /* This code used to handle METHOD_TYPE, but I don't think it's
+	     possible to get it here anymore.  */
+	  gcc_assert (TREE_CODE (type) != METHOD_TYPE);
 	  if (declarator->kind == cdk_ptrmem
-	      && (TREE_CODE (type) == FUNCTION_TYPE
-		  || (memfn_quals && TREE_CODE (type) == METHOD_TYPE)))
+	      && TREE_CODE (type) == FUNCTION_TYPE)
 	    {
 	      memfn_quals |= type_memfn_quals (type);
 	      type = build_memfn_type (type,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]