if (Ty->isRecordType()) {
const RecordDecl *Record = Ty->getAs<RecordType>()->getDecl();
+ if (Record->isInvalidDecl())
+ return false;
+
if (Record->isUnion())
return unionHasUniqueObjectRepresentations(*this, Record);
EnterExpressionEvaluationContext Unevaluated(
Self, Sema::ExpressionEvaluationContext::Unevaluated);
Sema::SFINAETrap SFINAE(Self, /*AccessCheckingSFINAE=*/true);
- Sema::ContextRAII TUContext(Self, Self.Context.getTranslationUnitDecl());
+ Sema::ContextRAII TUContext(Self, Self.Context.getTranslationUnitDecl()); {
ExprResult Result = Self.BuildBinOp(/*S=*/nullptr, KeyLoc, BO_Assign, &Lhs,
&Rhs);
if (Result.isInvalid() || SFINAE.hasErrorOccurred())
llvm_unreachable("unhandled type trait");
return false;
+ }
}
default: llvm_unreachable("not a BTT");
}
has_unique_object_representations<CanBeUniqueIfNoPadding>::value,
"inherit from std layout");
+namespace ErrorType {
+ struct S; //expected-note{{forward declaration of 'ErrorType::S'}}
+
+ struct T {
+ S t; //expected-error{{field has incomplete type 'ErrorType::S'}}
+ };
+ bool b = __has_unique_object_representations(T);
+};