From: Anders Carlsson Date: Fri, 29 Jan 2010 02:47:33 +0000 (+0000) Subject: Simplify InitListChecker::CheckReferenceType X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6fe0bf89db4372c9e8e8a5c2a50593c2977df29;p=clang Simplify InitListChecker::CheckReferenceType git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94793 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index bc7210c568..a70582dd53 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -785,17 +785,16 @@ void InitListChecker::CheckReferenceType(const InitializedEntity &Entity, return; } - Expr *savExpr = expr; // Might be promoted by CheckSingleInitializer. - if (SemaRef.CheckReferenceInit(expr, DeclType, - /*FIXME:*/expr->getLocStart(), - /*SuppressUserConversions=*/false, - /*AllowExplicit=*/false, - /*ForceRValue=*/false)) + Sema::OwningExprResult Result = + SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(), + SemaRef.Owned(expr)); + + if (Result.isInvalid()) hadError = true; - else if (savExpr != expr) { - // The type was promoted, update initializer list. - IList->setInit(Index, expr); - } + + expr = Result.takeAs(); + IList->setInit(Index, expr); + if (hadError) ++StructuredIndex; else @@ -3270,7 +3269,7 @@ InitializationSequence::Perform(Sema &S, S.Diag(BitField->getLocation(), diag::note_bitfield_decl); return S.ExprError(); } - + // Reference binding does not have any corresponding ASTs. // Check exception specifications