Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mangling for instantiation-dependent non-type template parameter types #20

zygoloid opened this Issue Jul 5, 2017 · 1 comment


None yet
2 participants
Copy link

commented Jul 5, 2017

The mangling for a function template does not include the instantiation-dependent portions of non-type template parameters (including such things transitively within template template parameters). This is becoming increasingly important as people try to write things like:

template<typename T, std::void_t<typename T::x>* = nullptr> void func() {}
template<typename T, std::void_t<typename T::y>* = nullptr> void func() {}

(std::void_t<T> is void for all T. It's not obvious whether it's supposed to be a dependent type, but the above cases are at least instantiation-dependent types.)

For a type T providing both a nested x and a nested y, we will mangle instantiations of the two possible func<T>s the same, despite them being distinct templates.

Including the (pre-substitution) types of non-type template parameters in the mangling (if they're instantiation-dependent) seems like the obvious fix, but it would likely result in an ABI break for a significant amount of existing code.

We should probably at least fix this for ABI v2.


This comment has been minimized.

Copy link

commented Jul 5, 2017

It would likely be an innocuous break, as very little code relies on equivalence of function template specializations. I tend to agree that we still shouldn't break it, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.