[cfe-commits] r86210 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/SemaCXX/overload-call.cpp utils/C++Tests/LLVM-Syntax/lit.local.cfg
Douglas Gregor
dgregor at apple.com
Thu Nov 5 17:02:41 PST 2009
Author: dgregor
Date: Thu Nov 5 19:02:41 2009
New Revision: 86210
URL: http://llvm.org/viewvc/llvm-project?rev=86210&view=rev
Log:
When we encounter a derived-to-base conversion when performing an
implicit conversion sequence, check the validity of this conversion
and then perform it.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/overload-call.cpp
cfe/trunk/utils/C++Tests/LLVM-Syntax/lit.local.cfg
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=86210&r1=86209&r2=86210&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Nov 5 19:02:41 2009
@@ -1295,6 +1295,16 @@
ImpCastExprToType(From, Context.BoolTy, CastExpr::CK_Unknown);
break;
+ case ICK_Derived_To_Base:
+ if (CheckDerivedToBaseConversion(From->getType(),
+ ToType.getNonReferenceType(),
+ From->getLocStart(),
+ From->getSourceRange()))
+ return true;
+ ImpCastExprToType(From, ToType.getNonReferenceType(),
+ CastExpr::CK_DerivedToBase);
+ break;
+
default:
assert(false && "Improper second standard conversion");
break;
@@ -1312,7 +1322,7 @@
CastExpr::CK_NoOp,
ToType->isLValueReferenceType());
break;
-
+
default:
assert(false && "Improper second standard conversion");
break;
Modified: cfe/trunk/test/SemaCXX/overload-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overload-call.cpp?rev=86210&r1=86209&r2=86210&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overload-call.cpp (original)
+++ cfe/trunk/test/SemaCXX/overload-call.cpp Thu Nov 5 19:02:41 2009
@@ -278,3 +278,16 @@
void db_rebind_test(Z2 z2) {
float& f1 = db_rebind(z2);
}
+
+class string { };
+class opt : public string { };
+
+struct SR {
+ SR(const string&);
+};
+
+void f(SR) { }
+
+void g(opt o) {
+ f(o);
+}
Modified: cfe/trunk/utils/C++Tests/LLVM-Syntax/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/C%2B%2BTests/LLVM-Syntax/lit.local.cfg?rev=86210&r1=86209&r2=86210&view=diff
==============================================================================
--- cfe/trunk/utils/C++Tests/LLVM-Syntax/lit.local.cfg (original)
+++ cfe/trunk/utils/C++Tests/LLVM-Syntax/lit.local.cfg Thu Nov 5 19:02:41 2009
@@ -12,8 +12,11 @@
# testFormat: The test format to use to interpret tests.
config.test_format = lit.formats.SyntaxCheckTest(compiler=root.clang,
dir='%s/include/llvm' % root.llvm_src_root,
- recursive=False,
+ recursive=True,
pattern='^(.*\\.h|[^.]*)$',
+ excludes=['DAGISelHeader.h',
+ 'AIXDataTypesFix.h',
+ 'Solaris.h'],
extra_cxx_args=['-D__STDC_LIMIT_MACROS',
'-D__STDC_CONSTANT_MACROS',
'-Wno-sign-compare',
More information about the cfe-commits
mailing list