[PATCH] D126818: Itanium ABI: Implement mangling for constrained friends

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 05:59:28 PDT 2022


erichkeane added a comment.

In D126818#3554617 <https://reviews.llvm.org/D126818#3554617>, @tahonermann wrote:

> I wonder if I'm reading (temp.friend)p9` sentence 2 <http://eel.is/c++draft/temp.friend#9.sentence-2> correctly. Which of these should it be parsed as?
>
> 1. A (friend function template with a constraint) that depends on a template parameter from an enclosing template shall be a definition.
> 2. A friend function template (with a constraint that depends on a template parameter from an enclosing template) shall be a definition.
>
> I'm guessing that the first interpretation is the intent.

I believe it is the 2nd one actually.  A friend function with a constraint, where said constraint depends on a template param from an enclosing template, shall be a definition.  And only THOSE are protected against being a 'duplicate' of another in a different scope. I essentially implemented the former in this (as it is a superset of the cases) for the purposes of mangling, but I think that was the wrong idea. The result would be that when the constraint does NOT depend on a enclosing template, we end up emitting different names for the same function in different TUs (potentially).  Initially I thought that was fine, but it ends up with extra duplication.

Note we might be confused, the parens there aren't completely clear as to what your intent is.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126818/new/

https://reviews.llvm.org/D126818



More information about the cfe-commits mailing list