Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release/19.x: [Clang] Fix crash due to invalid source location in __is_trivially_equality_comparable (#107815) #108147

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

llvmbot
Copy link
Collaborator

@llvmbot llvmbot commented Sep 11, 2024

Backport 6dbdb84

Requested by: @philnik777

@llvmbot llvmbot added this to the LLVM 19.X Release milestone Sep 11, 2024
@llvmbot
Copy link
Collaborator Author

llvmbot commented Sep 11, 2024

@DimitryAndric What do you think about merging this PR to the release branch?

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Sep 11, 2024
@llvmbot
Copy link
Collaborator Author

llvmbot commented Sep 11, 2024

@llvm/pr-subscribers-clang

Author: None (llvmbot)

Changes

Backport 6dbdb84

Requested by: @philnik777


Full diff: https://github.com/llvm/llvm-project/pull/108147.diff

2 Files Affected:

  • (modified) clang/lib/Sema/SemaExprCXX.cpp (+2-1)
  • (modified) clang/test/SemaCXX/type-traits.cpp (+18)
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 14d1f395af90e3..de50786f4d6c07 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -5140,7 +5140,8 @@ static bool HasNonDeletedDefaultedEqualityComparison(Sema &S,
 
     // const ClassT& obj;
     OpaqueValueExpr Operand(
-        {}, Decl->getTypeForDecl()->getCanonicalTypeUnqualified().withConst(),
+        KeyLoc,
+        Decl->getTypeForDecl()->getCanonicalTypeUnqualified().withConst(),
         ExprValueKind::VK_LValue);
     UnresolvedSet<16> Functions;
     // obj == obj;
diff --git a/clang/test/SemaCXX/type-traits.cpp b/clang/test/SemaCXX/type-traits.cpp
index 7c5be2ab374a75..608852da703312 100644
--- a/clang/test/SemaCXX/type-traits.cpp
+++ b/clang/test/SemaCXX/type-traits.cpp
@@ -3958,6 +3958,24 @@ class Template {};
 // Make sure we don't crash when instantiating a type
 static_assert(!__is_trivially_equality_comparable(Template<Template<int>>));
 
+
+struct S operator==(S, S);
+
+template <class> struct basic_string_view {};
+
+struct basic_string {
+  operator basic_string_view<int>() const;
+};
+
+template <class T>
+const bool is_trivially_equality_comparable = __is_trivially_equality_comparable(T);
+
+template <int = is_trivially_equality_comparable<basic_string> >
+void find();
+
+void func() { find(); }
+
+
 namespace hidden_friend {
 
 struct TriviallyEqualityComparable {

Copy link
Collaborator

@DimitryAndric DimitryAndric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tru
Copy link
Collaborator

tru commented Sep 13, 2024

Hi, since we are wrapping up LLVM 19.1.0 we are very strict with the fixes we pick at this point. Can you please respond to the following questions to help me understand if this has to be included in the final release or not.

Is this PR a fix for a regression or a critical issue?

What is the risk of accepting this into the release branch?

What is the risk of NOT accepting this into the release branch?

@DimitryAndric
Copy link
Collaborator

Is this PR a fix for a regression or a critical issue?

Regression (assertion/crash while building the chromium parts of qt webengine)

What is the risk of accepting this into the release branch?

Very low. This only initializes a function parameter which was previously empty.

What is the risk of NOT accepting this into the release branch?

People will file tickets that their qt webengine builds are crashing. :)

@tru tru merged commit 6278084 into llvm:release/19.x Sep 16, 2024
8 of 10 checks passed
Copy link

@philnik777 (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
Development

Successfully merging this pull request may close these issues.

4 participants