Skip to content

Commit 4087cdd

Browse files
committed
fix
1 parent af0f58c commit 4087cdd

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
@@ -1083,6 +1083,8 @@ Bug Fixes to C++ Support
10831083
- Clang now diagnoses explicit object parameters in member pointers and other contexts where they should not appear.
10841084
Fixes (#GH85992).
10851085
- Fixed a crash-on-invalid bug involving extraneous template parameter with concept substitution. (#GH73885)
1086+
- Fixed an assertion failure about a constraint of a friend function template references to a value with greater
1087+
template depth than the friend function template. (#GH98258)
10861088

10871089
Bug Fixes to AST Handling
10881090
^^^^^^^^^^^^^^^^^^^^^^^^^

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)