Fix crash in constraining partial specialization on nested template.

Fixes: https://github.com/llvm/llvm-project/issues/53354

Differential Revision: https://reviews.llvm.org/D136259
This commit is contained in:
Utkarsh Saxena 2022-10-19 16:29:42 +02:00
parent ca0a0bf963
commit 4c87e12484
2 changed files with 22 additions and 2 deletions

View File

@ -5803,8 +5803,8 @@ struct MarkUsedTemplateParameterVisitor :
}
bool TraverseTemplateName(TemplateName Template) {
if (auto *TTP =
dyn_cast<TemplateTemplateParmDecl>(Template.getAsTemplateDecl()))
if (auto *TTP = llvm::dyn_cast_or_null<TemplateTemplateParmDecl>(
Template.getAsTemplateDecl()))
if (TTP->getDepth() == Depth)
Used[TTP->getIndex()] = true;
RecursiveASTVisitor<MarkUsedTemplateParameterVisitor>::

View File

@ -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> && true
struct A<T> {};