hokein created this revision. hokein added a reviewer: sammccall. Herald added a project: All. hokein requested review of this revision. Herald added a project: clang.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D123808 Files: clang/lib/Sema/SemaDeclCXX.cpp clang/test/CXX/temp/temp.deduct.guide/p3.cpp Index: clang/test/CXX/temp/temp.deduct.guide/p3.cpp =================================================================== --- clang/test/CXX/temp/temp.deduct.guide/p3.cpp +++ clang/test/CXX/temp/temp.deduct.guide/p3.cpp @@ -55,8 +55,6 @@ } using N::NamedNS1; NamedNS1(int) -> NamedNS1<int>; // expected-error {{deduction guide must be declared in the same scope as template}} - // FIXME: remove the following bogus diagnostic - // expected-error@-2{{deduction guide is not written as a specialization of template 'NamedNS1'}} using namespace N; NamedNS2(int) -> NamedNS2<int>; // expected-error {{deduction guide must be declared in the same scope as template}} Index: clang/lib/Sema/SemaDeclCXX.cpp =================================================================== --- clang/lib/Sema/SemaDeclCXX.cpp +++ clang/lib/Sema/SemaDeclCXX.cpp @@ -11023,9 +11023,12 @@ TemplateName SpecifiedName = RetTST.getTypePtr()->getTemplateName(); bool TemplateMatches = Context.hasSameTemplateName(SpecifiedName, GuidedTemplate); - // FIXME: We should consider other template kinds (using, qualified), - // otherwise we will emit bogus diagnostics. - if (SpecifiedName.getKind() == TemplateName::Template && TemplateMatches) + auto TKind = SpecifiedName.getKind(); + // Template names within TemplateSpecializationType are never qualified + // template names! + if ((TKind == TemplateName::Template || + TKind == TemplateName::UsingTemplate) && + TemplateMatches) AcceptableReturnType = true; else { // This could still instantiate to the right type, unless we know it
Index: clang/test/CXX/temp/temp.deduct.guide/p3.cpp =================================================================== --- clang/test/CXX/temp/temp.deduct.guide/p3.cpp +++ clang/test/CXX/temp/temp.deduct.guide/p3.cpp @@ -55,8 +55,6 @@ } using N::NamedNS1; NamedNS1(int) -> NamedNS1<int>; // expected-error {{deduction guide must be declared in the same scope as template}} - // FIXME: remove the following bogus diagnostic - // expected-error@-2{{deduction guide is not written as a specialization of template 'NamedNS1'}} using namespace N; NamedNS2(int) -> NamedNS2<int>; // expected-error {{deduction guide must be declared in the same scope as template}} Index: clang/lib/Sema/SemaDeclCXX.cpp =================================================================== --- clang/lib/Sema/SemaDeclCXX.cpp +++ clang/lib/Sema/SemaDeclCXX.cpp @@ -11023,9 +11023,12 @@ TemplateName SpecifiedName = RetTST.getTypePtr()->getTemplateName(); bool TemplateMatches = Context.hasSameTemplateName(SpecifiedName, GuidedTemplate); - // FIXME: We should consider other template kinds (using, qualified), - // otherwise we will emit bogus diagnostics. - if (SpecifiedName.getKind() == TemplateName::Template && TemplateMatches) + auto TKind = SpecifiedName.getKind(); + // Template names within TemplateSpecializationType are never qualified + // template names! + if ((TKind == TemplateName::Template || + TKind == TemplateName::UsingTemplate) && + TemplateMatches) AcceptableReturnType = true; else { // This could still instantiate to the right type, unless we know it
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits