aaron.ballman added inline comments.
================ Comment at: lib/Sema/SemaType.cpp:8022 + else if (LangOpts.CPlusPlus && isCompleteType(Loc, T) && + !T.isTriviallyCopyableType(Context)) // Some other non-trivially-copyable type (probably a C++ class) ---------------- rsmith wrote: > efriedma wrote: > > If you're going to allow incomplete types in C++, you'll need some code to > > handle the case where the type is initially incomplete, but completed later. > Perhaps the trivially-copyable requirement could be deferred in all cases > until we reach an actual load or store. Constraints that are only enforced > when a type happens to be complete are generally a bad idea (we have a mess > like this for constraints on types being non-abstract, and we're still > working on unsticking ourselves from that mess in the C++ standard). > > In passing, I'd also note that we need the trivially-copyable requirement > even outside C++, for structs containing `__weak` / `__strong` fields. I'm not quite certain I've properly captured the request here, but I took a stab at it. One thing to note is that our behavior for type checking `__atomic_load()` appears to diverge from GCC with regards to trivial copyability, even before my patch. https://godbolt.org/g/g2fqLK https://reviews.llvm.org/D46112 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits