diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-16 16:54:16 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-16 16:54:16 +0000 |
commit | 52bb5d2a1474460707e5ca11656b2749a7a33a82 (patch) | |
tree | d43575c47f20841b95c69e58d5948a05d7af7740 /lib/Sema/SemaInit.cpp | |
parent | 125cebdc35dd8ff7965aa57a6ab630e2fc6fe5a3 (diff) |
In Sema::CheckInitializerTypes, replace a use of CheckReferenceInit with an InitializationSequence
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91542 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r-- | lib/Sema/SemaInit.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 04506908f0..20008a7c1c 100644 --- a/lib/Sema/SemaInit.cpp +++ b/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. |