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

Tom Honermann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 6 20:59:59 PDT 2022


tahonermann added a comment.

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

Well, I know that I'm confused and not clear what my intent is :)

I asked the question because there appears to be an asymmetry between (temp.friend)p9 sentence 1 <http://eel.is/c++draft/temp.friend#9.sentence-1> and (temp.friend)p9 sentence 2 <http://eel.is/c++draft/temp.friend#9.sentence-2>. Sentence 1 applies to all constrained non-template friend declarations regardless of any template argument dependence while sentence 2 applies to just a subset of constrained friend function templates; those that have some amount of template dependence. The difference impacts when mangling differences are required.

I spent some time analyzing how gcc, clang, and MSVC handle these different cases. See https://godbolt.org/z/85E5eMh3x. Search for FIXME? to find cases where I think one or more of the compilers is misbehaving or where it is unclear to me whether or how [temp.friend]p9 applies. Some highlights:

- Some compilers diagnose some ill-formed cases when parsing the class template, others don't until the class template is instantiated. Not surprising.
- All of the compilers reject non-template friend function definitions with non-dependent constraints due to duplicate definitions, presumably in violation of [temp.friend]p9; see the `ff2()` example.
- All of the compilers reject non-template friend function definitions with dependent constraints due to duplicate definitions, presumably in violation of [temp.friend]p9; see the `ff6()` example.
- Name mangling is currently insufficient to differentiate (otherwise) non-dependent friend function templates with dependent constraints; see the `fft5()` and `fft6()` examples.
- None of the compilers reject some cases of non-definitions that should be rejected by [temp.friend]p9; see the `fft5()` and `fft7()` examples.




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

https://reviews.llvm.org/D126818



More information about the cfe-commits mailing list