https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82724

--- Comment #2 from David Blaikie <dblaikie at gmail dot com> ---
Thanks for chiming in, Paul - figured it was an interesting case I ran into
that came up against/near some of the stuff we'd touched on recently (for a hot
second I thought maybe Clang's omission of the template parameters was actually
causing a problem - if GCC produced them & all, until I noticed that it only
produced them under this particular situation and not under the other similar
situation)


As for the function-without-parameters counterexample: That's a bit different
due to function overloading, and the parameter types not being in the name. So
a function without parameters would be ambiguous whereas a class template name
provides a unique name (& one the consumer already needs to parse to be able to
match up between two different compilers anyway - otherwise the consumer would
think GCC's type* ("foo<(X)0u>") and Clang's type ("foo<Y>") were different
types - even if it did check the template argument DIEs matched - the actual
name doesn't match. Arguably it'd be easier to match if the DIEs are present,
since a consumer could look for the < and strip everything after it to do the
name match, then do the parameter match separately)

Also, GCC doesn't produce template parameters if they aren't named:

template<typename> struct foo { };
foo<int> f;

Contains no mention of the int type (except in the name of the structure type
"foo<int>"). Arguably Clang could do that optimization too, but it does seem a
bit weird to me and probably not especially significant I'd guess.

* For the example:
enum X { Y };
template <X x> struct foo {};
foo<Y> f;

Reply via email to