[cfe-commits] r91097 - in /cfe/trunk: lib/Sema/SemaInit.cpp lib/Sema/SemaInit.h test/CodeGenCXX/reference-init.cpp
Eli Friedman
eli.friedman at gmail.com
Thu Dec 10 18:42:07 PST 2009
Author: efriedma
Date: Thu Dec 10 20:42:07 2009
New Revision: 91097
URL: http://llvm.org/viewvc/llvm-project?rev=91097&view=rev
Log:
Fix a recent regression from the initialization changes.
Added:
cfe/trunk/test/CodeGenCXX/reference-init.cpp
Modified:
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaInit.h
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=91097&r1=91096&r2=91097&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Thu Dec 10 20:42:07 2009
@@ -2001,10 +2001,11 @@
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 @@
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(),
Modified: cfe/trunk/lib/Sema/SemaInit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.h?rev=91097&r1=91096&r2=91097&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.h (original)
+++ cfe/trunk/lib/Sema/SemaInit.h Thu Dec 10 20:42:07 2009
@@ -511,7 +511,7 @@
/// \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.
Added: cfe/trunk/test/CodeGenCXX/reference-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/reference-init.cpp?rev=91097&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/reference-init.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/reference-init.cpp Thu Dec 10 20:42:07 2009
@@ -0,0 +1,9 @@
+// RUN: clang-cc -emit-llvm-only -verify %s
+
+struct XPTParamDescriptor {};
+struct nsXPTParamInfo {
+ nsXPTParamInfo(const XPTParamDescriptor& desc);
+};
+void a(XPTParamDescriptor *params) {
+ const nsXPTParamInfo& paramInfo = params[0];
+}
More information about the cfe-commits
mailing list