aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorMatheus Izvekov <mizvekov@gmail.com>2021-09-13 15:35:45 +0200
committerMatheus Izvekov <mizvekov@gmail.com>2021-11-12 01:16:31 +0100
commit9b6036deedf28e10d797fc4ca734d57680d18053 (patch)
treec27b5d77fd4c7fc217f1e38f6572a4633bfdeb3f /clang/lib/Sema/SemaInit.cpp
parentac33e65d2169260364e3e92fed2ba81c58d5ce33 (diff)
downloadllvm-9b6036deedf28e10d797fc4ca734d57680d18053.zip
llvm-9b6036deedf28e10d797fc4ca734d57680d18053.tar.gz
llvm-9b6036deedf28e10d797fc4ca734d57680d18053.tar.bz2
[clang] retain type sugar in auto / template argument deduction
This implements the following changes: * AutoType retains sugared deduced-as-type. * Template argument deduction machinery analyses the sugared type all the way down. It would previously lose the sugar on first recursion. * Undeduced AutoType will be properly canonicalized, including the constraint template arguments. * Remove the decltype node created from the decltype(auto) deduction. As a result, we start seeing sugared types in a lot more test cases, including some which showed very unfriendly `type-parameter-*-*` types. Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D110216
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 75686e2..8e435d9 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -9972,7 +9972,7 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer(
auto TemplateName = DeducedTST->getTemplateName();
if (TemplateName.isDependent())
- return SubstAutoType(TSInfo->getType(), Context.DependentTy);
+ return SubstAutoTypeDependent(TSInfo->getType());
// We can only perform deduction for class templates.
auto *Template =
@@ -9991,7 +9991,7 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer(
Diag(TSInfo->getTypeLoc().getBeginLoc(),
diag::warn_cxx14_compat_class_template_argument_deduction)
<< TSInfo->getTypeLoc().getSourceRange() << 0;
- return SubstAutoType(TSInfo->getType(), Context.DependentTy);
+ return SubstAutoTypeDependent(TSInfo->getType());
}
// FIXME: Perform "exact type" matching first, per CWG discussion?