summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-12-16 16:54:16 +0000
committerDouglas Gregor <dgregor@apple.com>2009-12-16 16:54:16 +0000
commit59ae3c854240108b28a0b3cb0aa1e9fb4c90e5ff (patch)
tree41a6c57f97568045a4580e287720c888a158c070 /clang/lib/Sema/SemaInit.cpp
parent4044489d69fdb9a9a6ef4a56e84f2ecc2ddfe8a7 (diff)
downloadbcm5719-llvm-59ae3c854240108b28a0b3cb0aa1e9fb4c90e5ff.tar.gz
bcm5719-llvm-59ae3c854240108b28a0b3cb0aa1e9fb4c90e5ff.zip
In Sema::CheckInitializerTypes, replace a use of CheckReferenceInit with an InitializationSequence
llvm-svn: 91542
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 04506908f07..20008a7c1cd 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -192,11 +192,17 @@ bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType,
// A variable declared to be a T& or T&&, that is "reference to type T"
// (8.3.2), shall be initialized by an object, or function, of
// type T or by an object that can be converted into a T.
- if (DeclType->isReferenceType())
- return CheckReferenceInit(Init, DeclType, InitLoc,
- /*SuppressUserConversions=*/false,
- /*AllowExplicit=*/DirectInit,
- /*ForceRValue=*/false);
+ if (DeclType->isReferenceType()) {
+ InitializationSequence InitSeq(*this, Entity, Kind, &Init, 1);
+ OwningExprResult CurInit = InitSeq.Perform(*this, Entity, Kind,
+ MultiExprArg(*this, (void**)&Init, 1),
+ &DeclType);
+ if (CurInit.isInvalid())
+ return true;
+
+ Init = CurInit.takeAs<Expr>();
+ return false;
+ }
// C99 6.7.8p3: The type of the entity to be initialized shall be an array
// of unknown size ("[]") or an object type that is not a variable array type.
OpenPOWER on IntegriCloud