This revision was automatically updated to reflect the committed changes. Closed by commit rC324134: Make __has_unique_object_representations reject empty union types. (authored by EricWF, committed by ).
Repository: rL LLVM https://reviews.llvm.org/D42863 Files: lib/AST/ASTContext.cpp test/SemaCXX/type-traits.cpp Index: test/SemaCXX/type-traits.cpp =================================================================== --- test/SemaCXX/type-traits.cpp +++ test/SemaCXX/type-traits.cpp @@ -2566,6 +2566,7 @@ static_assert(!has_unique_object_representations<volatile int &>::value, "No references!"); static_assert(!has_unique_object_representations<const volatile int &>::value, "No references!"); static_assert(!has_unique_object_representations<Empty>::value, "No empty types!"); +static_assert(!has_unique_object_representations<EmptyUnion>::value, "No empty types!"); class Compressed : Empty { int x; Index: lib/AST/ASTContext.cpp =================================================================== --- lib/AST/ASTContext.cpp +++ lib/AST/ASTContext.cpp @@ -2145,7 +2145,7 @@ if (FieldSize != UnionSize) return false; } - return true; + return !RD->field_empty(); } static bool isStructEmpty(QualType Ty) {
Index: test/SemaCXX/type-traits.cpp =================================================================== --- test/SemaCXX/type-traits.cpp +++ test/SemaCXX/type-traits.cpp @@ -2566,6 +2566,7 @@ static_assert(!has_unique_object_representations<volatile int &>::value, "No references!"); static_assert(!has_unique_object_representations<const volatile int &>::value, "No references!"); static_assert(!has_unique_object_representations<Empty>::value, "No empty types!"); +static_assert(!has_unique_object_representations<EmptyUnion>::value, "No empty types!"); class Compressed : Empty { int x; Index: lib/AST/ASTContext.cpp =================================================================== --- lib/AST/ASTContext.cpp +++ lib/AST/ASTContext.cpp @@ -2145,7 +2145,7 @@ if (FieldSize != UnionSize) return false; } - return true; + return !RD->field_empty(); } static bool isStructEmpty(QualType Ty) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits