Skip to content

Commit 558168e

Browse files
committed
fix nttp
1 parent 5d7f291 commit 558168e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,10 +1664,7 @@ class ConstraintRefersToContainingTemplateChecker
16641664
}
16651665

16661666
void CheckNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {
1667-
assert(D->getDepth() <= TemplateDepth &&
1668-
"Nothing should reference a value below the actual template depth, "
1669-
"depth is likely wrong");
1670-
if (D->getDepth() != TemplateDepth)
1667+
if (D->getDepth() < TemplateDepth)
16711668
Result = true;
16721669

16731670
// Necessary because the type of the NTTP might be what refers to the parent

clang/test/SemaTemplate/concepts-friends.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,11 @@ struct S {
517517
friend void f2() requires requires { [](auto){}; } {
518518
return;
519519
}
520+
521+
template <typename U>
522+
friend void f3() requires requires { []<int X>(){ return X; }; } {
523+
return;
524+
}
520525
};
521526

522527
}

0 commit comments

Comments
 (0)