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]

Re: [C++ Patch] PR 19200


Hi,

On 06/10/2014 03:40 AM, Jason Merrill wrote:
I think the parser approach is more correct.
I suspected that, in fact it's the first approach I tried, but the additional parameter in many places made me a little nervous and persisted ;)
On 06/09/2014 07:02 PM, Paolo Carlini wrote:
                  !TYPE_WAS_ANONYMOUS (class_type)
+                 && !friend_p
                  && constructor_name_p (unqualified_name,
                             class_type))

But here you also need to check qualifying_scope; 'friend' does not affect whether or not a qualified-id is a constructor.
Thanks. Fiddling with the qualifying_scope bit I noticed that we also crashed in constructor_name_p for friend10.C below, that is when CLASS_TYPE_P (qualifying_scope) is false, it's a namespace. When I figured out the right condition, I noticed that grokdeclarator also needed an adjustment: ctype, set by:

        if (ctype == NULL_TREE
        && decl_context == FIELD
        && funcdecl_p
        && (friendp == 0 || dname == current_class_name))
          ctype = current_class_type;

means that, later on:

  if (ctype && TREE_CODE (type) == FUNCTION_TYPE && staticp < 2
      && !NEW_DELETE_OPNAME_P (unqualified_id))

is true and build_memfn_type is called. Then grokfndecl calls set_decl_namespace which fails because compares a FUNCTION_TYPE to a METHOD_TYPE. Simply clearing ctype when we know we are handling a friendp appears to do the trick and passes the testsuite...

Thanks!
Paolo.

//////////////////

Attachment: CL_19200_2
Description: Text document

Attachment: patch_19200_2
Description: Text document


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