[cfe-commits] r135101 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/conversion-function.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Wed Jul 13 15:53:21 PDT 2011
Author: rsmith
Date: Wed Jul 13 17:53:21 2011
New Revision: 135101
URL: http://llvm.org/viewvc/llvm-project?rev=135101&view=rev
Log:
PR8800: When building a conversion to A& using a member operatorA&(), do not require A to be a complete type.
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/SemaCXX/conversion-function.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=135101&r1=135100&r2=135101&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Jul 13 17:53:21 2011
@@ -4535,19 +4535,19 @@
CK_FunctionToPointerDecay,
&ConversionRef, VK_RValue);
- QualType CallResultType
- = Conversion->getConversionType().getNonLValueExprType(Context);
- if (RequireCompleteType(From->getLocStart(), CallResultType, 0)) {
+ QualType ConversionType = Conversion->getConversionType();
+ if (RequireCompleteType(From->getLocStart(), ConversionType, 0)) {
Candidate.Viable = false;
Candidate.FailureKind = ovl_fail_bad_final_conversion;
return;
}
- ExprValueKind VK = Expr::getValueKindForType(Conversion->getConversionType());
+ ExprValueKind VK = Expr::getValueKindForType(ConversionType);
// Note that it is safe to allocate CallExpr on the stack here because
// there are 0 arguments (i.e., nothing is allocated using ASTContext's
// allocator).
+ QualType CallResultType = ConversionType.getNonLValueExprType(Context);
CallExpr Call(Context, &ConversionFn, 0, 0, CallResultType, VK,
From->getLocStart());
ImplicitConversionSequence ICS =
Modified: cfe/trunk/test/SemaCXX/conversion-function.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/conversion-function.cpp?rev=135101&r1=135100&r2=135101&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/conversion-function.cpp (original)
+++ cfe/trunk/test/SemaCXX/conversion-function.cpp Wed Jul 13 17:53:21 2011
@@ -378,3 +378,17 @@
generic_list<generic_list<int> > l;
array<array<int> > a = l;
}
+
+namespace PR8800 {
+ struct A;
+ struct C {
+ operator A&();
+ };
+ void f() {
+ C c;
+ A& a1(c);
+ A& a2 = c;
+ A& a3 = static_cast<A&>(c);
+ A& a4 = (A&)c;
+ }
+}
More information about the cfe-commits
mailing list