https://github.com/keinflue updated 
https://github.com/llvm/llvm-project/pull/176619

>From ba360e80a0fdcac4df61f8f33434be96492a633d Mon Sep 17 00:00:00 2001
From: keinflue <[email protected]>
Date: Sat, 24 Jan 2026 16:57:12 +0100
Subject: [PATCH] [clang] Don't assert on perfect overload match with _Atomic

An assertion incorrectly treated difference in _Atomic qualification as
different types for the purpose of verifying a perfect match in overload
resolution in C++.

Fixes #170433
---
 clang/docs/ReleaseNotes.rst           |  1 +
 clang/include/clang/Sema/Overload.h   |  3 ++-
 clang/test/SemaCXX/crash-GH170433.cpp | 16 ++++++++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 clang/test/SemaCXX/crash-GH170433.cpp

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 611e3fba2bc2b..0ca02214de362 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -151,6 +151,7 @@ Miscellaneous Clang Crashes Fixed
 - Fixed a crash when attempting to jump over initialization of a variable with 
variably modified type. (#GH175540)
 - Fixed a crash when using loop hint with a value dependent argument inside a
   generic lambda. (#GH172289)
+- Fixed a crash in C++ overload resolution with ``_Atomic``-qualified argument 
types. (#GH170433)
 
 OpenACC Specific Changes
 ------------------------
diff --git a/clang/include/clang/Sema/Overload.h 
b/clang/include/clang/Sema/Overload.h
index cc9be00e9108c..d42963e325b58 100644
--- a/clang/include/clang/Sema/Overload.h
+++ b/clang/include/clang/Sema/Overload.h
@@ -444,7 +444,8 @@ class Sema;
           if (auto *N = T->getAs<MemberPointerType>();
               N && N->isMemberFunctionPointer())
             T = C.getDecayedType(N->getPointeeType());
-          return T;
+
+          return T.getAtomicUnqualifiedType();
         };
         // The types might differ if there is an array-to-pointer conversion
         // an function-to-pointer conversion, or lvalue-to-rvalue conversion.
diff --git a/clang/test/SemaCXX/crash-GH170433.cpp 
b/clang/test/SemaCXX/crash-GH170433.cpp
new file mode 100644
index 0000000000000..9fedafafd89fa
--- /dev/null
+++ b/clang/test/SemaCXX/crash-GH170433.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -verify %s
+
+// https://github.com/llvm/llvm-project/issues/170433
+
+// expected-no-diagnostics
+
+void f(double);
+
+template <class = int>
+void f(double);
+
+_Atomic double atomic_value = 42.5;
+
+void test() {
+    f(atomic_value);
+}

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to