Skip to content

Commit 47db720

Browse files
committed
Fix assertion failure during operator overload resolution.
1 parent d5ff21d commit 47db720

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

clang/lib/Sema/SemaConcept.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,8 @@ bool Sema::IsAtLeastAsConstrained(NamedDecl *D1,
15191519
auto IsExpectedEntity = [](const FunctionDecl *FD) {
15201520
FunctionDecl::TemplatedKind Kind = FD->getTemplatedKind();
15211521
return Kind == FunctionDecl::TK_NonTemplate ||
1522-
Kind == FunctionDecl::TK_FunctionTemplate;
1522+
Kind == FunctionDecl::TK_FunctionTemplate ||
1523+
Kind == FunctionDecl::TK_FunctionTemplateSpecialization;
15231524
};
15241525
const auto *FD2 = dyn_cast<FunctionDecl>(D2);
15251526
(void)IsExpectedEntity;

clang/test/SemaCXX/PR98671.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %clang_cc1 -std=c++20 -fsyntax-only %s -verify
2+
3+
struct S {
4+
operator int();
5+
6+
template <typename T>
7+
operator T();
8+
};
9+
10+
11+
// Ensure that no assertion is raised when overload resolution fails while
12+
// choosing between an operator function template and an operator function.
13+
constexpr auto r = &S::operator int;
14+
// expected-error@-1 {{initializer of type '<overloaded function type>'}}

0 commit comments

Comments
 (0)