Hi,

On 08/01/2014 08:30 PM, Jason Merrill wrote:
On 07/31/2014 01:36 PM, Paolo Carlini wrote:
The problem is that when grokfndecl calls duplicate_decls in such member cases it looks through TEMPLATE_DECLs and then telling apart the two cases above is tough, both are FUNCTION_DECLs

Ideas about the best way to handle that?
Could you just condition it on DECL_TEMPLATE_INFO?
Of course, thanks! I have no idea why I thought I was unable to go back to the template information :( Then the whole issue - of course, again - is easy.

       tree t2 = TYPE_ARG_TYPES (TREE_TYPE (newdecl));
       int i = 1;

-      if (TREE_CODE (TREE_TYPE (newdecl)) == METHOD_TYPE)
+      if (DECL_NONSTATIC_MEMBER_FUNCTION_P (newdecl))
         t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2);

Let's use FUNCTION_FIRST_USER_PARMTYPE instead.

-      if (TREE_CODE (TREE_TYPE (newdecl)) == METHOD_TYPE
+      if (DECL_FUNCTION_MEMBER_P (newdecl)

This change is OK.
Thanks, I'm attaching below what I'm going to apply.

I will return to the separate DECL_NONSTATIC_MEMBER_FUNCTION_P mini project after c++/15339.

Paolo.
Index: decl.c
===================================================================
--- decl.c      (revision 213439)
+++ decl.c      (working copy)
@@ -1706,14 +1706,11 @@ duplicate_decls (tree newdecl, tree olddecl, bool
        ;
       else if (TREE_CODE (olddecl) == FUNCTION_DECL)
        {
-         tree t1 = TYPE_ARG_TYPES (TREE_TYPE (olddecl));
-         tree t2 = TYPE_ARG_TYPES (TREE_TYPE (newdecl));
+         tree t1 = FUNCTION_FIRST_USER_PARMTYPE (olddecl);
+         tree t2 = FUNCTION_FIRST_USER_PARMTYPE (newdecl);
          int i = 1;
 
-         if (TREE_CODE (TREE_TYPE (newdecl)) == METHOD_TYPE)
-           t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2);
-
-         if (TREE_CODE (TREE_TYPE (newdecl)) == METHOD_TYPE
+         if (DECL_FUNCTION_MEMBER_P (newdecl)
              && CLASSTYPE_TEMPLATE_INFO (CP_DECL_CONTEXT (newdecl)))
            {
              /* C++11 8.3.6/6.

Reply via email to