[clang] [clang] Enable C++17 relaxed template template argument matching by default (PR #89807)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 26 02:06:41 PDT 2024
================
@@ -507,10 +507,62 @@ static TemplateDeductionResult DeduceNonTypeTemplateArgument(
S, TemplateParams, NTTP, DeducedTemplateArgument(New), T, Info, Deduced);
}
+static NamedDecl *DeduceTemplateArguments(Sema &S, NamedDecl *A,
+ TemplateArgument Default) {
+ switch (A->getKind()) {
+ case Decl::TemplateTypeParm: {
+ auto *T = cast<TemplateTypeParmDecl>(A);
+ // FIXME: DefaultArgument can't represent a pack.
+ if (T->isParameterPack())
----------------
cor3ntin wrote:
My question was more whether we want to deduce packs at all.
I think the new behavior make sense, in that it is consistent with https://eel.is/c++draft/temp.deduct#partial-11 (
I suspect because both candidates are valid, this tie breaker gets triggered)
We might change that in the future, but now packs can't be defaulted, so I struggle to come up to think of a case where considering the pack would change the order of partial ordering (and not trailing packs can't be deduced)
here are more tests which I think are consistent https://godbolt.org/z/5Ke3TGfK6
https://github.com/llvm/llvm-project/pull/89807
More information about the cfe-commits
mailing list