usaxena95 updated this revision to Diff 468925. usaxena95 added a comment. Added test.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136259/new/ https://reviews.llvm.org/D136259 Files: clang/lib/Sema/SemaTemplateDeduction.cpp clang/test/SemaTemplate/concepts-GH53354.cpp Index: clang/test/SemaTemplate/concepts-GH53354.cpp =================================================================== --- /dev/null +++ clang/test/SemaTemplate/concepts-GH53354.cpp @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -std=c++20 -verify %s +// expected-no-diagnostics + +template <template <class> class> +struct S +{}; + +template <class T> +concept C1 = requires +{ + typename S<T::template value_types>; +}; + +template <class T> +requires C1<T> +struct A {}; + +template <class T> +requires C1<T> and true +struct A<T> {}; \ No newline at end of file Index: clang/lib/Sema/SemaTemplateDeduction.cpp =================================================================== --- clang/lib/Sema/SemaTemplateDeduction.cpp +++ clang/lib/Sema/SemaTemplateDeduction.cpp @@ -5804,10 +5804,10 @@ } bool TraverseTemplateName(TemplateName Template) { - if (auto *TTP = - dyn_cast<TemplateTemplateParmDecl>(Template.getAsTemplateDecl())) - if (TTP->getDepth() == Depth) - Used[TTP->getIndex()] = true; + if (TemplateDecl *TD = Template.getAsTemplateDecl()) + if (auto *TTP = dyn_cast<TemplateTemplateParmDecl>(TD)) + if (TTP->getDepth() == Depth) + Used[TTP->getIndex()] = true; RecursiveASTVisitor<MarkUsedTemplateParameterVisitor>:: TraverseTemplateName(Template); return true;
Index: clang/test/SemaTemplate/concepts-GH53354.cpp =================================================================== --- /dev/null +++ clang/test/SemaTemplate/concepts-GH53354.cpp @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -std=c++20 -verify %s +// expected-no-diagnostics + +template <template <class> class> +struct S +{}; + +template <class T> +concept C1 = requires +{ + typename S<T::template value_types>; +}; + +template <class T> +requires C1<T> +struct A {}; + +template <class T> +requires C1<T> and true +struct A<T> {}; \ No newline at end of file Index: clang/lib/Sema/SemaTemplateDeduction.cpp =================================================================== --- clang/lib/Sema/SemaTemplateDeduction.cpp +++ clang/lib/Sema/SemaTemplateDeduction.cpp @@ -5804,10 +5804,10 @@ } bool TraverseTemplateName(TemplateName Template) { - if (auto *TTP = - dyn_cast<TemplateTemplateParmDecl>(Template.getAsTemplateDecl())) - if (TTP->getDepth() == Depth) - Used[TTP->getIndex()] = true; + if (TemplateDecl *TD = Template.getAsTemplateDecl()) + if (auto *TTP = dyn_cast<TemplateTemplateParmDecl>(TD)) + if (TTP->getDepth() == Depth) + Used[TTP->getIndex()] = true; RecursiveASTVisitor<MarkUsedTemplateParameterVisitor>:: TraverseTemplateName(Template); return true;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits