zoecarver added inline comments.
================ Comment at: clang/lib/Sema/SemaDeclCXX.cpp:6416 + if (D->hasAttr<TrivialABIAttr>()) + return true; + ---------------- rjmccall wrote: > I don't think we can just unconditionally check for the attribute. The rule > for `trivial_abi` is that it overrides direct sources of non-triviality, but > if there's a subobject which can't be safely passed in registers, we'll still > pass aggregates indirectly. This means we can safely add the attribute > whenever a class's own special members don't rely on non-triviality without > having to recursively check the component types. If there's a non-trivial field (or base) then the attribute won't be applied and a warning will be emitted. See the below tests (though, it would probably be good to add some more). ================ Comment at: clang/test/SemaCXX/attr-trivial-abi.cpp:30 // Diagnose invalid trivial_abi even when the type is templated because it has a non-trivial field. template <class T> ---------------- Here. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92361/new/ https://reviews.llvm.org/D92361 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits