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++ RFC/Patch] PR 39813


Hi,

On 04/28/2015 02:59 PM, Jason Merrill wrote:
On 04/28/2015 08:54 AM, Paolo Carlini wrote:
Hi,

On 04/28/2015 02:45 PM, Jason Merrill wrote:
On 04/28/2015 06:59 AM, Paolo Carlini wrote:
       && !DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t)
the name
of the macro seems weird to me: it mentions friends (and friends are
mentioned in its comment too) but isn't used only for DECL_FRIEND_P true and indeed it is true for the non-friend 'fn' in the snippet at issue).

It shouldn't be true for fn, that's a bug.
Ok, but then what? Its definition boils down to very basic macros:

#define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
   (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))

It could be only matter of adding a DECL_FRIEND_P check at the beginning?
Sure, that sounds likely.
The simple idea almost works. The below however has an additional STRIP_TEMPLATE, which I added to avoid ICEs for testcases like g++.dg/template/friend26.C, where DECL_FRIEND_P of plain tmpl is false, whereas DECL_FRIEND_P of STRIP_TEMPLATE (tmpl) is true for the use of DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION in template_for_substitution. Does that make sense? Then we come to the two *remaining* regressions:

    g++.old-deja/g++.pt/friend10.C
    g++.old-deja/g++.pt/link1.C

which fail at link time. Those would disappear if I replace the already mentioned DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION in template_for_substitution with the old implemention of it, just checking DECL_TEMPLATE_INFO && !DECL_USE_TEMPLATE. Interestingly, note that with current (and old) clang too these two tests do nor link. I'm a bit stuck on this...

Thanks!
Paolo.

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

Attachment: patch_39813_draft
Description: Text document


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