[PATCH] D91488: Consider reference, pointer, and pointer-to-membber TemplateArguments to be different if they have different types.
Arthur O'Dwyer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 15 06:31:37 PST 2020
Quuxplusone added inline comments.
================
Comment at: clang/lib/AST/ItaniumMangle.cpp:4861
+ // We need correct types when the template-name is unresolved or when it
+ // might be overloaded.
+ if (!ResolvedTemplate)
----------------
And from the PR summary:
> namely mangling such template arguments as being cast to the parameter type in the case where the template name is unresolved or overloaded
This phrasing worries me a little bit. Are you saying that you might mangle the name of `foo<SomeT>` in one way, when there's also a `foo<Some, Other, Args>` in scope, and in a different way, when there's not? That doesn't seem conforming. So I imagine it's more likely that I'm misunderstanding what you mean by "might be overloaded" / "is overloaded". Could you explain for my information, and perhaps also adjust the wording of these code comments to make the explanation less needed?
Specifically, I think it would be non-conforming if the TU
// https://godbolt.org/z/YjPqMd
template<char *> void foo();
char arr[6];
extern template void foo<arr>(); // #1
int main() { foo<arr>(); }
could not be linked against the TU
template<int> int foo();
template<char *> void foo(); // is this "overloading"?
extern char arr[6];
template<> void foo<arr>() {} // #2
because lines #1 and #2 disagreed about the way to mangle `foo<arr>`. (Again, I'm pretty sure you haven't made them disagree... but I remain unclear on what's meant by "overloading" in this PR, if it's //not// this.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91488/new/
https://reviews.llvm.org/D91488
More information about the cfe-commits
mailing list