[clang] [clang][PAC] Fix builtins that claim address discriminated types are bitwise compatible (PR #154490)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 23 01:31:14 PDT 2025


================
@@ -1438,6 +1438,10 @@ void CXXRecordDecl::addedMember(Decl *D) {
         data().StructuralIfLiteral = false;
     }
 
+    if (!data().HasTrivialSpecialMembers &&
+        T.hasAddressDiscriminatedPointerAuth())
+      data().HasTrivialSpecialMembers = true;
----------------
cor3ntin wrote:

I think i would prefer that piece of code to remain (fixed!) - I suspect (and you should check) that your call to `setNonTrivialToPrimitiveCopy` is why this does not break anything.
However, afaict, `setNonTrivialToPrimitiveCopy` is mostly a C thing, and i think in C it would be better to say that a type with a ptrauth member is not trivially copyable (and not trivially assignable, movable, presumably)

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


More information about the cfe-commits mailing list