[clang] [clang][PAC] Fix builtins that claim address discriminated types are bitwise compatible (PR #154490)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 21 01:12:23 PDT 2025
================
@@ -1438,6 +1438,10 @@ void CXXRecordDecl::addedMember(Decl *D) {
data().StructuralIfLiteral = false;
}
+ if (!data().HasTrivialSpecialMembers &&
+ T.hasAddressDiscriminatedPointerAuth())
+ data().HasTrivialSpecialMembers = true;
----------------
ojhunt wrote:
I think I put this in while fighting battery life last night, but I'm super annoyed that nothing got triggered warning wise (maybe need to add yet more warnings for preferred type?).
But more annoyingly I can't find a way to make it do the wrong thing - basically what this code ends up doing is saying none of the special member functions are defaulted, which is already going to be true due to the address discriminated value - *except* the addition of the default constructor which is set arbitrarily. This should make it possible to have a class that has a non-defaulted default constructor be treated as if it were trivially defaulted. But to hit the code paths that actually change behavior due to that you need to get past things like pod type checks (which always fail with address discrimination).
Annoying that something this dumb is wrong, and not caught by the compiler, and cannot be tested because the same state that leads to the error means the error cannot impact anything.
https://github.com/llvm/llvm-project/pull/154490
More information about the cfe-commits
mailing list