Index: lib/Sema/SemaExprCXX.cpp =================================================================== --- lib/Sema/SemaExprCXX.cpp +++ lib/Sema/SemaExprCXX.cpp @@ -5108,6 +5108,13 @@ return E; bool IsDecltype = ExprEvalContexts.back().IsDecltype; + + if (!IsDecltype && + RequireCompleteType(E->getExprLoc(), QualType(RT, 0), + diag::err_typecheck_decl_incomplete_type, + SourceRange(E->getLocStart(), E->getLocEnd()))) + return ExprError(); + CXXDestructorDecl *Destructor = IsDecltype ? nullptr : LookupDestructor(RD); if (Destructor) { Index: lib/Sema/SemaInit.cpp =================================================================== --- lib/Sema/SemaInit.cpp +++ lib/Sema/SemaInit.cpp @@ -1074,6 +1074,17 @@ // Fall through for subaggregate initialization } + if (SemaRef.RequireCompleteType(expr->getExprLoc(), ElemType, 0)) { + if (!VerifyOnly) + SemaRef.Diag(expr->getLocStart(), + diag::err_typecheck_decl_incomplete_type) + << ElemType << expr->getSourceRange(); + hadError = true; + ++Index; + ++StructuredIndex; + return; + } + // C++ [dcl.init.aggr]p12: // // [...] Otherwise, if the member is itself a non-empty Index: test/CXX/dcl.decl/dcl.init/dcl.init.list/p3-0x.cpp =================================================================== --- test/CXX/dcl.decl/dcl.init/dcl.init.list/p3-0x.cpp +++ test/CXX/dcl.decl/dcl.init/dcl.init.list/p3-0x.cpp @@ -125,3 +125,9 @@ // expected-note@-2 {{in initialization of temporary of type 'rdar13395022::MoveOnly [1]' created to list-initialize this reference}} } } + +namespace incomplete { +union U; // expected-note{{forward declaration}} +U(&&a)[]{}; // expected-error {{variable has incomplete type}} +U(&&b)[]{123}; // expected-error {{variable has incomplete type}} expected-note {{in initialization of temporary}} +} Index: test/Modules/submodules-merge-defs.cpp =================================================================== --- test/Modules/submodules-merge-defs.cpp +++ test/Modules/submodules-merge-defs.cpp @@ -8,7 +8,7 @@ A pre_a; // expected-error {{must be imported}} expected-error {{must use 'struct'}} // expected-note@defs.h:1 +{{here}} // FIXME: We should warn that use_a is being used without being imported. -int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}} +int pre_use_a = use_a(pre_a); // expected-error +{{'A' must be imported}} B::Inner2 pre_bi; // expected-error +{{must be imported}} // expected-note@defs.h:4 +{{here}}