[clang] 73ebada - [clang] Don't assert on perfect overload match with _Atomic (#176619)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 25 08:57:31 PST 2026
Author: keinflue
Date: 2026-01-25T17:57:26+01:00
New Revision: 73ebadaa837e039a1c07c9d373841cfb1eb0eb2b
URL: https://github.com/llvm/llvm-project/commit/73ebadaa837e039a1c07c9d373841cfb1eb0eb2b
DIFF: https://github.com/llvm/llvm-project/commit/73ebadaa837e039a1c07c9d373841cfb1eb0eb2b.diff
LOG: [clang] Don't assert on perfect overload match with _Atomic (#176619)
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
Added:
clang/test/SemaCXX/crash-GH170433.cpp
Modified:
clang/docs/ReleaseNotes.rst
clang/include/clang/Sema/Overload.h
Removed:
################################################################################
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index df4b21fc26ff1..a5340a31d4fe9 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -198,6 +198,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
diff er 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);
+}
More information about the cfe-commits
mailing list