aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCXXCast.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-06 01:14:41 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-06 01:14:41 +0000
commitb653c52d9176a4faecf923f792758f4454f7f78c (patch)
treeb68d6c7221bebdc0cd6b73cd687dc247a3fbbe77 /lib/Sema/SemaCXXCast.cpp
parentb7a86f5c5f9cdea126817247cc1fd3a7441388da (diff)
If we have a C-style cast, functional cast, or a static_cast to a
class type, don't perform the array-to-pointer or function-to-pointer conversions, because we may end up binding a reference to a function or array. With this change, FileCheck now passes -fsyntax-only! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86211 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCXXCast.cpp')
-rw-r--r--lib/Sema/SemaCXXCast.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp
index 76faddaa03..eb931f33a2 100644
--- a/lib/Sema/SemaCXXCast.cpp
+++ b/lib/Sema/SemaCXXCast.cpp
@@ -388,7 +388,7 @@ CheckStaticCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
return;
}
- if (!DestType->isLValueReferenceType())
+ if (!DestType->isLValueReferenceType() && !DestType->isRecordType())
Self.DefaultFunctionArrayConversion(SrcExpr);
unsigned msg = diag::err_bad_cxx_cast_generic;
@@ -1104,7 +1104,7 @@ bool Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr,
if (CastTy->isDependentType() || CastExpr->isTypeDependent())
return false;
- if (!CastTy->isLValueReferenceType())
+ if (!CastTy->isLValueReferenceType() && !CastTy->isRecordType())
DefaultFunctionArrayConversion(CastExpr);
// C++ [expr.cast]p5: The conversions performed by