answer until after instantiation. Fixes PR16061!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184890
91177308-0d34-0410-b5e6-
96231b3b80d8
assert(FD);
assert(getLangOpts().CPlusPlus && "valid check only for C++");
- if (FD->isInvalidDecl())
- return true;
+ if (FD->isInvalidDecl() || FD->getType()->isDependentType())
+ return false;
QualType EltTy = Context.getBaseElementType(FD->getType());
if (const RecordType *RT = EltTy->getAs<RecordType>()) {
o2 = optional<non_trivial>();
}
}
+
+namespace pr16061 {
+ struct X { X(); };
+
+ template<typename T> struct Test1 {
+ union {
+ struct {
+ X x;
+ };
+ };
+ };
+
+ template<typename T> struct Test2 {
+ union {
+ struct { // expected-note {{default constructor of 'Test2<pr16061::X>' is implicitly deleted because variant field '' has a non-trivial default constructor}}
+ T x;
+ };
+ };
+ };
+
+ Test2<X> t2x; // expected-error {{call to implicitly-deleted default constructor of 'Test2<pr16061::X>'}}
+}