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

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 1 13:31:20 PDT 2022


erichkeane added a subscriber: rsmith.
erichkeane added a comment.

Note this was mentioned as a 'must also do' in my discussion on deferred constraints with @rsmith, however as this already fails, I don't see this as a prerequisite.  However, I think this is easy enough to just do.

THAT SAID: The proposal on the itanium-abi github wasn't particularly clear as to which of the following three options were the 'right' answer.  I'm hoping @rjmccall can decide whether this is acceptable:

Option 1: Change the mangling of ALL friend functions.  I determined this is likely an ABI break on otherwise 'settled' code, and figured we wouldn't want to do this.

Option 2: Change the mangling for ALL constrained friend functions.  This seemed easy enough to do, AND changes the mangling for things only covered by 'experimental' concepts support.  So I think changing the ABI for current things is OK here.

Option 3: Change the mangling for constrained friend functions that fall under temp.friend p9.  The only difference between this and Option2 is that this would need to check the 'template friend function depends on containing scope'.  I don't believe this is necessary so long as we are consistent with it.  Presumably this could end up with multiple symbols for functions that are the 'same declaration' by rule in separate translation units, such as:

  struct Base{};
  template<int N>
  struct S {
    template<typename U>
    friend void func(Base&) requires(U::value) {}
  };
  void uses() {
    S<1> s;
    S<2> s2; // This is an error during Sema, since 'func' is a duplicate here.
    func(s); // all S<N>s SHOULD end up with the same declaration, but in different TUs they might end up with different copies here?
  }

In typing this comment up, I believe I got the 'option' wrong here.  Should I have gone with #3 above?   I'm going to think about it overnight (and hope you reviewer folks can chime in!) and get to it in the morning.


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

https://reviews.llvm.org/D126818



More information about the cfe-commits mailing list