Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions clang/lib/Sema/SemaTemplateDeduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,20 +712,19 @@ DeduceTemplateSpecArguments(Sema &S, TemplateParameterList *TemplateParams,
if (const auto *TD = TNA.getAsTemplateDecl(); TD && TD->isTypeAlias())
return TemplateDeductionResult::Success;

// Perform template argument deduction for the template name.
if (auto Result =
DeduceTemplateArguments(S, TemplateParams, TNP, TNA, Info,
SA->template_arguments(), Deduced);
Result != TemplateDeductionResult::Success)
return Result;

// FIXME: To preserve sugar, the TST needs to carry sugared resolved
// arguments.
ArrayRef<TemplateArgument> AResolved =
SA->getCanonicalTypeInternal()
->castAs<TemplateSpecializationType>()
->template_arguments();

// Perform template argument deduction for the template name.
if (auto Result = DeduceTemplateArguments(S, TemplateParams, TNP, TNA, Info,
AResolved, Deduced);
Result != TemplateDeductionResult::Success)
return Result;

// Perform template argument deduction on each template
// argument. Ignore any missing/extra arguments, since they could be
// filled in by default arguments.
Expand Down
16 changes: 16 additions & 0 deletions clang/test/SemaTemplate/cwg2398.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,19 @@ namespace consistency {
// new-error@-1 {{ambiguous partial specializations}}
} // namespace t2
} // namespace consistency

namespace regression1 {
template <typename T, typename Y> struct map {};
template <typename T> class foo {};

template <template <typename...> class MapType, typename Value>
Value bar(MapType<int, Value> map);

template <template <typename...> class MapType, typename Value>
Value bar(MapType<int, foo<Value>> map);

void aux() {
map<int, foo<int>> input;
bar(input);
}
} // namespace regression1