Open rjmccall opened 1 year ago
Something that came up in discussion on #111: what should we do with array-to-pointer decay, in the case where a precise type is not needed? This has been valid since C++98, as an exception to the old general rule that a pointer template parameter couldn't point to a subobject. For example:
int arr[32];
template<int *> struct X {};
void f(X<arr>) {}
GCC mangles this as _Z1f1XIXadL_Z3arrEEE
. Clang already implements part of this PR and uses an adsoiL_Z3arrE
mangling. But this seems like an avoidable break for GCC: as a very special case, we could instead say that a pointer to the first element of an array is mangled the same as the array itself when precise typing isn't needed and the parameter is not of type cv void *
. On the other hand, Clang already took the ABI break here and it seems to not have been problematic, so maybe it's not worth adding a special case.
Thanks for preparing this! I have some questions inline.
Alright, I should take another look at this.
This includes the material from #47 (non-type template arguments), #63 (class constants), and the
template-param-decl
portions of #85 (C++20 lambda-expressions).@zygoloid gets credit for most of this, although I've made a few substantive changes from his suggestions.