assert(Self.Context.hasSameUnqualifiedType(LhsT, RhsT)
== (lhsRecord == rhsRecord));
+ // Unions are never base classes, and never have base classes.
+ // It doesn't matter if they are complete or not. See PR#41843
+ if (lhsRecord && lhsRecord->getDecl()->isUnion())
+ return false;
+ if (rhsRecord && rhsRecord->getDecl()->isUnion())
+ return false;
+
if (lhsRecord == rhsRecord)
- return !lhsRecord->getDecl()->isUnion();
+ return true;
// C++0x [meta.rel]p2:
// If Base and Derived are class types and are different types
enum Enum { EV };
struct POD { Enum e; int i; float f; NonPOD* p; };
struct Empty {};
+struct IncompleteStruct;
typedef Empty EmptyAr[10];
typedef Empty EmptyArNB[];
typedef Empty EmptyArMB[1][2];
{ int arr[F(__is_base_of(Base, NonderivedTemp<int>))]; }
{ int arr[F(__is_base_of(Base, UndefinedTemp<int>))]; } // expected-error {{implicit instantiation of undefined template 'UndefinedTemp<int>'}}
+ { int arr[F(__is_base_of(IncompleteUnion, IncompleteUnion))]; }
+ { int arr[F(__is_base_of(Union, IncompleteUnion))]; }
+ { int arr[F(__is_base_of(IncompleteUnion, Union))]; }
+ { int arr[F(__is_base_of(IncompleteStruct, IncompleteUnion))]; }
+ { int arr[F(__is_base_of(IncompleteUnion, IncompleteStruct))]; }
+ { int arr[F(__is_base_of(Empty, IncompleteUnion))]; }
+ { int arr[F(__is_base_of(IncompleteUnion, Empty))]; }
+ { int arr[F(__is_base_of(int, IncompleteUnion))]; }
+ { int arr[F(__is_base_of(IncompleteUnion, int))]; }
+ { int arr[F(__is_base_of(Empty, Union))]; }
+ { int arr[F(__is_base_of(Union, Empty))]; }
+ { int arr[F(__is_base_of(int, Empty))]; }
+ { int arr[F(__is_base_of(Union, int))]; }
+
isBaseOfT<Base, Derived>();
isBaseOfF<Derived, Base>();