[llvm-branch-commits] [cfe-branch] r119267 - in /cfe/branches/Apple/whitney: lib/Sema/SemaOverload.cpp test/SemaTemplate/instantiate-complete.cpp
Daniel Dunbar
daniel at zuster.org
Mon Nov 15 13:47:06 PST 2010
Author: ddunbar
Date: Mon Nov 15 15:47:06 2010
New Revision: 119267
URL: http://llvm.org/viewvc/llvm-project?rev=119267&view=rev
Log:
Merge r119005:
--
Author: Douglas Gregor <dgregor at apple.com>
Date: Sat Nov 13 19:36:57 2010 +0000
When we're type-checking the result of calling a conversion function
(while computing user conversion sequences), make sure that a result
of class type is a complete class type. Had we gone through
ActOnCallExpr, this would have happened when we built the CallExpr.
Fixes PR8425.
Modified:
cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp
cfe/branches/Apple/whitney/test/SemaTemplate/instantiate-complete.cpp
Modified: cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp?rev=119267&r1=119266&r2=119267&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp Mon Nov 15 15:47:06 2010
@@ -3876,11 +3876,18 @@
CK_FunctionToPointerDecay,
&ConversionRef, VK_RValue);
+ QualType CallResultType
+ = Conversion->getConversionType().getNonLValueExprType(Context);
+ if (RequireCompleteType(From->getLocStart(), CallResultType, 0)) {
+ Candidate.Viable = false;
+ Candidate.FailureKind = ovl_fail_bad_final_conversion;
+ return;
+ }
+
// 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).
- CallExpr Call(Context, &ConversionFn, 0, 0,
- Conversion->getConversionType().getNonLValueExprType(Context),
+ CallExpr Call(Context, &ConversionFn, 0, 0, CallResultType,
From->getLocStart());
ImplicitConversionSequence ICS =
TryCopyInitialization(*this, &Call, ToType,
Modified: cfe/branches/Apple/whitney/test/SemaTemplate/instantiate-complete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaTemplate/instantiate-complete.cpp?rev=119267&r1=119266&r2=119267&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaTemplate/instantiate-complete.cpp (original)
+++ cfe/branches/Apple/whitney/test/SemaTemplate/instantiate-complete.cpp Mon Nov 15 15:47:06 2010
@@ -126,3 +126,23 @@
template class B<int>; // expected-note {{in instantiation}}
}
+
+namespace PR8425 {
+ template <typename T>
+ class BaseT {};
+
+ template <typename T>
+ class DerivedT : public BaseT<T> {};
+
+ template <typename T>
+ class FromT {
+ public:
+ operator DerivedT<T>() const { return DerivedT<T>(); }
+ };
+
+ void test() {
+ FromT<int> ft;
+ BaseT<int> bt(ft);
+ }
+}
+
More information about the llvm-branch-commits
mailing list