[clang] [clang][SemaCXX] Fix crash when using static_cast to _Atomic types in C++ (PR #207616)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 6 05:34:04 PDT 2026


================
@@ -78,7 +78,13 @@ namespace {
       // the qualifier.
       if (!S.Context.getLangOpts().ObjC && !DestType->isRecordType() &&
           !DestType->isArrayType() && !DestType.getPointerAuth()) {
-        DestType = DestType.getAtomicUnqualifiedType();
+        if (S.Context.getLangOpts().CPlusPlus) {
+          // Note that in C++, _Atomic(T) is a distinct type, not a
+          // cv-qualifier, so it is not stripped.
+          DestType = DestType.getUnqualifiedType();
+        } else {
+          DestType = DestType.getAtomicUnqualifiedType();
+        }
----------------
cor3ntin wrote:

Why are you stripping non-atomic qualifiers in c++?


https://github.com/llvm/llvm-project/pull/207616


More information about the cfe-commits mailing list