summaryrefslogtreecommitdiffstats
path: root/clang/lib
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
commitad8b22269efc89858f1ef2bf0ba35e9a12f1d26d (patch)
tree9db5e95091fba5f46137a05c22602572c3a58677 /clang/lib
parent02ba0ea46137225189469670fec3aa237e8aed16 (diff)
downloadbcm5719-llvm-ad8b22269efc89858f1ef2bf0ba35e9a12f1d26d.tar.gz
bcm5719-llvm-ad8b22269efc89858f1ef2bf0ba35e9a12f1d26d.zip
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! llvm-svn: 86211
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaCXXCast.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaCXXCast.cpp b/clang/lib/Sema/SemaCXXCast.cpp
index 76faddaa038..eb931f33a2b 100644
--- a/clang/lib/Sema/SemaCXXCast.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud