Skip to content

Commit 5d7f291

Browse files
committed
fix
1 parent 9a3e66e commit 5d7f291

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ Bug Fixes to C++ Support
158158

159159
- Fixed a crash when an expression with a dependent ``__typeof__`` type is used as the operand of a unary operator. (#GH97646)
160160
- Fixed a failed assertion when checking invalid delete operator declaration. (#GH96191)
161+
- Fixed an assertion failure about a constraint of a friend function template references to a value with greater
162+
template depth than the friend function template. (#GH98258)
161163

162164
Bug Fixes to AST Handling
163165
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,10 +1691,7 @@ class ConstraintRefersToContainingTemplateChecker
16911691
using inherited::TransformTemplateTypeParmType;
16921692
QualType TransformTemplateTypeParmType(TypeLocBuilder &TLB,
16931693
TemplateTypeParmTypeLoc TL, bool) {
1694-
assert(TL.getDecl()->getDepth() <= TemplateDepth &&
1695-
"Nothing should reference a value below the actual template depth, "
1696-
"depth is likely wrong");
1697-
if (TL.getDecl()->getDepth() != TemplateDepth)
1694+
if (TL.getDecl()->getDepth() < TemplateDepth)
16981695
Result = true;
16991696
return inherited::TransformTemplateTypeParmType(
17001697
TLB, TL,

clang/test/SemaTemplate/concepts-friends.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,3 +504,19 @@ template struct Z<int>;
504504
Y y(1);
505505

506506
}
507+
508+
namespace GH98258 {
509+
510+
struct S {
511+
template <typename U>
512+
friend void f() requires requires { []<typename V>(V){}; } {
513+
return;
514+
}
515+
516+
template <typename U>
517+
friend void f2() requires requires { [](auto){}; } {
518+
return;
519+
}
520+
};
521+
522+
}

0 commit comments

Comments
 (0)