[PATCH] D128351: [clang] missing outer template levels when checking template constraints
Sirui Mu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 22 20:27:39 PDT 2022
Lancern updated this revision to Diff 439253.
Lancern added a comment.
Fix some regression issues
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128351/new/
https://reviews.llvm.org/D128351
Files:
clang/lib/Sema/SemaConcept.cpp
clang/test/SemaCXX/template-member-alias-constraint.cpp
Index: clang/test/SemaCXX/template-member-alias-constraint.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaCXX/template-member-alias-constraint.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify
+
+template <typename T>
+concept Foo = true;
+
+template <typename T, typename U>
+struct Bar {};
+
+template <typename T>
+struct Baz {
+ template <Foo U>
+ using BazBar = Bar<T, U>;
+
+ using BazBarInt = BazBar<int>; // expected-no-diagnostics
+};
+
+template <typename urng_t>
+struct contiguous_range {
+ template <bool const_range>
+ requires(const_range == false)
+ using basic_iterator = int;
+
+ auto begin() {
+ return basic_iterator<false>{}; // expected-no-diagnostics
+ }
+};
Index: clang/lib/Sema/SemaConcept.cpp
===================================================================
--- clang/lib/Sema/SemaConcept.cpp
+++ clang/lib/Sema/SemaConcept.cpp
@@ -293,6 +293,10 @@
MultiLevelTemplateArgumentList MLTAL;
MLTAL.addOuterTemplateArguments(TemplateArgs);
+ if (const TypeAliasTemplateDecl *AliasTemplate =
+ dyn_cast_or_null<TypeAliasTemplateDecl>(Template)) {
+ MLTAL.addOuterRetainedLevels(AliasTemplate->getTemplateDepth());
+ }
for (const Expr *ConstraintExpr : ConstraintExprs) {
if (calculateConstraintSatisfaction(S, Template, TemplateArgs,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128351.439253.patch
Type: text/x-patch
Size: 1387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220623/84f9bc32/attachment.bin>
More information about the cfe-commits
mailing list