llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: None (keinflue) <details> <summary>Changes</summary> 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 --- Full diff: https://github.com/llvm/llvm-project/pull/176619.diff 3 Files Affected: - (modified) clang/docs/ReleaseNotes.rst (+1) - (modified) clang/include/clang/Sema/Overload.h (+3-3) - (added) clang/test/SemaCXX/crash-GH170433.cpp (+16) ``````````diff diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index b75715e873c50..59dd2d239391e 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -147,6 +147,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..ec29d45c0aa58 100644 --- a/clang/include/clang/Sema/Overload.h +++ b/clang/include/clang/Sema/Overload.h @@ -444,13 +444,13 @@ 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. // In some cases, this may happen even if First is not set. - assert(C.hasSameUnqualifiedType(Decay(getFromType()), - Decay(getToType(2)))); + assert(C.hasSameType(Decay(getFromType()), Decay(getToType(2)))); #endif return true; } 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); +} `````````` </details> https://github.com/llvm/llvm-project/pull/176619 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
