]> granicus.if.org Git - clang/commitdiff
Simplify InitListChecker::CheckReferenceType
authorAnders Carlsson <andersca@mac.com>
Fri, 29 Jan 2010 02:47:33 +0000 (02:47 +0000)
committerAnders Carlsson <andersca@mac.com>
Fri, 29 Jan 2010 02:47:33 +0000 (02:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94793 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaInit.cpp

index bc7210c568acecb40a1b094df4d05a1816e8aaff..a70582dd53a4349890f18bcc37d73fb2ade4f100 100644 (file)
@@ -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<Expr>();
+    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