Skip to content

Commit 6278084

Browse files
philnik777tru
authored andcommitted
[Clang] Fix crash due to invalid source location in __is_trivially_equality_comparable (#107815)
Fixes #107777 (cherry picked from commit 6dbdb84)
1 parent d752f29 commit 6278084

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5140,7 +5140,8 @@ static bool HasNonDeletedDefaultedEqualityComparison(Sema &S,
51405140

51415141
// const ClassT& obj;
51425142
OpaqueValueExpr Operand(
5143-
{}, Decl->getTypeForDecl()->getCanonicalTypeUnqualified().withConst(),
5143+
KeyLoc,
5144+
Decl->getTypeForDecl()->getCanonicalTypeUnqualified().withConst(),
51445145
ExprValueKind::VK_LValue);
51455146
UnresolvedSet<16> Functions;
51465147
// obj == obj;

clang/test/SemaCXX/type-traits.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3958,6 +3958,24 @@ class Template {};
39583958
// Make sure we don't crash when instantiating a type
39593959
static_assert(!__is_trivially_equality_comparable(Template<Template<int>>));
39603960

3961+
3962+
struct S operator==(S, S);
3963+
3964+
template <class> struct basic_string_view {};
3965+
3966+
struct basic_string {
3967+
operator basic_string_view<int>() const;
3968+
};
3969+
3970+
template <class T>
3971+
const bool is_trivially_equality_comparable = __is_trivially_equality_comparable(T);
3972+
3973+
template <int = is_trivially_equality_comparable<basic_string> >
3974+
void find();
3975+
3976+
void func() { find(); }
3977+
3978+
39613979
namespace hidden_friend {
39623980

39633981
struct TriviallyEqualityComparable {

0 commit comments

Comments
 (0)