diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-12-11 02:42:07 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-12-11 02:42:07 +0000 |
commit | ad6c2e5b3a5e8b765692911e2e8d7a2c0b532f27 (patch) | |
tree | 4d21d3b6a76016207d477c97f9733f6190303561 /clang/lib | |
parent | a17e83e437d69d8279c6e7abeae1ee6c07207f0b (diff) | |
download | bcm5719-llvm-ad6c2e5b3a5e8b765692911e2e8d7a2c0b532f27.tar.gz bcm5719-llvm-ad6c2e5b3a5e8b765692911e2e8d7a2c0b532f27.zip |
Fix a recent regression from the initialization changes.
llvm-svn: 91097
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 21 | ||||
-rw-r--r-- | clang/lib/Sema/SemaInit.h | 2 |
2 files changed, 13 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 08ae7cbfbed..a1fd79b8523 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -2001,10 +2001,11 @@ void InitializationSequence::AddReferenceBindingStep(QualType T, Steps.push_back(S); } -void InitializationSequence::AddUserConversionStep(FunctionDecl *Function) { +void InitializationSequence::AddUserConversionStep(FunctionDecl *Function, + QualType T) { Step S; S.Kind = SK_UserConversion; - S.Type = Function->getResultType().getNonReferenceType(); + S.Type = T; S.Function = Function; Steps.push_back(S); } @@ -2209,18 +2210,20 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S, if (OverloadingResult Result = S.BestViableFunction(CandidateSet, DeclLoc, Best)) return Result; - - // Add the user-defined conversion step. + FunctionDecl *Function = Best->Function; - Sequence.AddUserConversionStep(Function); - - // Determine whether we need to perform derived-to-base or - // cv-qualification adjustments. + + // Compute the returned type of the conversion. if (isa<CXXConversionDecl>(Function)) T2 = Function->getResultType(); else T2 = cv1T1; - + + // Add the user-defined conversion step. + Sequence.AddUserConversionStep(Function, T2.getNonReferenceType()); + + // Determine whether we need to perform derived-to-base or + // cv-qualification adjustments. bool NewDerivedToBase = false; Sema::ReferenceCompareResult NewRefRelationship = S.CompareReferenceRelationship(DeclLoc, T1, T2.getNonReferenceType(), diff --git a/clang/lib/Sema/SemaInit.h b/clang/lib/Sema/SemaInit.h index debb0deaddc..a29159ace59 100644 --- a/clang/lib/Sema/SemaInit.h +++ b/clang/lib/Sema/SemaInit.h @@ -511,7 +511,7 @@ public: /// \brief Add a new step invoking a conversion function, which is either /// a constructor or a conversion function. - void AddUserConversionStep(FunctionDecl *Function); + void AddUserConversionStep(FunctionDecl *Function, QualType T); /// \brief Add a new step that performs a qualification conversion to the /// given type. |