Index: cfe/trunk/lib/Sema/SemaTemplate.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaTemplate.cpp +++ cfe/trunk/lib/Sema/SemaTemplate.cpp @@ -2052,6 +2052,12 @@ void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template, SourceLocation Loc) { + if (CXXRecordDecl *DefRecord = + cast(Template->getTemplatedDecl())->getDefinition()) { + TemplateDecl *DescribedTemplate = DefRecord->getDescribedClassTemplate(); + Template = DescribedTemplate ? DescribedTemplate : Template; + } + DeclContext *DC = Template->getDeclContext(); if (DC->isDependentContext()) return; Index: cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp =================================================================== --- cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp +++ cfe/trunk/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp @@ -489,6 +489,21 @@ } #pragma clang diagnostic pop +namespace PR41549 { + +template struct umm; + +template +struct umm { + umm(H h = 0, P p = 0); +}; + +template struct umm; + +umm m(1); + +} + #else // expected-no-diagnostics