diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2013-09-24 23:21:41 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2013-09-24 23:21:41 +0000 |
commit | 01ae093cbc7f347f509cfc8e53b8c2c36e0146b2 (patch) | |
tree | 563118f50e335fda1209e97543646568b24e42b6 /lib/Sema/SemaCast.cpp | |
parent | 2ae28e57a2d5e3456171fa1ade37060169583e38 (diff) |
Allow dynamic_cast to void* even with -fno-rtti.
PR17346.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCast.cpp')
-rw-r--r-- | lib/Sema/SemaCast.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaCast.cpp b/lib/Sema/SemaCast.cpp index 46b5b45306..ba00b712aa 100644 --- a/lib/Sema/SemaCast.cpp +++ b/lib/Sema/SemaCast.cpp @@ -669,8 +669,10 @@ void CastOperation::CheckDynamicCast() { Self.MarkVTableUsed(OpRange.getBegin(), cast<CXXRecordDecl>(SrcRecord->getDecl())); - // dynamic_cast is not available with fno-rtti - if (!Self.getLangOpts().RTTI) { + // dynamic_cast is not available with -fno-rtti. + // As an exception, dynamic_cast to void* is available because it doesn't + // use RTTI. + if (!Self.getLangOpts().RTTI && !DestPointee->isVoidType()) { Self.Diag(OpRange.getBegin(), diag::err_no_dynamic_cast_with_fno_rtti); SrcExpr = ExprError(); return; |