[PATCH] D136259: Fix crash in constraining partial specialization on nested template.
Utkarsh Saxena via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 19 08:24:04 PDT 2022
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136259.468925.patch
Type: text/x-patch
Size: 1346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221019/def4b7dc/attachment.bin>
More information about the cfe-commits
mailing list