[PATCH] D46112: Allow _Atomic to be specified on incomplete types

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 12 10:27:53 PDT 2018


aaron.ballman added a comment.

In https://reviews.llvm.org/D46112#1091981, @efriedma wrote:

> I think the request was that we check that a type is trivially copyable when we perform an atomic operation?  I don't see the code for that anywhere.


Sorry about that -- I didn't notice that GNU was handled while C11 was not. That's been updated now.

> Also needs some test coverage for atomic operations which aren't calls, like "typedef struct S S; void f(_Atomic S *s, _Atomic S *s2) { *s = *s2; };".

Thank you for pointing this out -- that uncovered an issue where we were not properly diagnosing the types as being incomplete. I've added a new test case and rolled the contents of Sema\atomic-type.cpp (which I added in an earlier patch) into SemaCXX\atomic-type.cpp (which already existed and I missed it).

I believe the change I made to `Type::isIncompleteType()` is correct, but was surprised by the new behavior in SemaCXX/atomic-type.cpp that resulted. It appears that the `RecordDecl` for "struct inner" has `IsCompleteDefinition` set to `false` while instantiating `struct atomic`, but I'm not familiar enough with the template instantiation process to know whether this is reasonable or not.


https://reviews.llvm.org/D46112





More information about the cfe-commits mailing list