You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GCC, Clang, and ICC agree that this is mangled as _Z1fIPiEvDTcmcvv_ELi1EE. But that mangling omits the instantiation-dependent T* expression.
We don't seem to have a <type> production to handle this. Presumably the right mangling would be _Z1fIPiEvDTcmcv6void_tIPT_E_ELi1EE, but that would require mangling this instantiation-dependent name for int as a <class-enum-type>.
Similar things happen for:
struct impl { using type = void; };
template<typename T> using alias = impl;
template<typename T> void f(decltype(alias<T*>::type(), 1)) {}
template void f<int*>(int);
... which GCC rejects, ICC mangles as _Z1fIPiEvDTcmcvv_ELi1EE, and Clang currently mangles as _Z1fIPiEvi but will soon mangle the same as ICC.
The text was updated successfully, but these errors were encountered:
This is really a problem with the mangling of template aliases, I think. The ABI is quite clear that implementations are required to mangle instantiation-dependent types, expressions, template names, etc. syntactically, and as far as I know implementations are generally good about that. The problem is that template aliases don't have to actually use all their template arguments, and so the ABI's rule that uses of template aliases be mangled as their underlying type doesn't necessarily preserve instantiation-dependence.
It seems to me that the fix is to only mangle applications of template aliases as their underlying type when the alias references all of its template arguments and therefore substitution preserves instantiation-dependence.
CWG1979 looks like it will give us a mechanism to power this: for "simple" alias templates, we can mangle as the substituted result, and for any other alias template we can mangle it as a simple-template-id -- and doing so would be correct because only "simple" alias templates are equivalent to their expansion.
Testcase:
GCC, Clang, and ICC agree that this is mangled as
_Z1fIPiEvDTcmcvv_ELi1EE
. But that mangling omits the instantiation-dependentT*
expression.We don't seem to have a
<type>
production to handle this. Presumably the right mangling would be_Z1fIPiEvDTcmcv6void_tIPT_E_ELi1EE
, but that would require mangling this instantiation-dependent name forint
as a<class-enum-type>
.Similar things happen for:
... which GCC rejects, ICC mangles as
_Z1fIPiEvDTcmcvv_ELi1EE
, and Clang currently mangles as_Z1fIPiEvi
but will soon mangle the same as ICC.The text was updated successfully, but these errors were encountered: