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
diff --git a/clang/lib/Sema/SemaCXXCast.cpp b/clang/lib/Sema/SemaCXXCast.cpp
index 76fadda..eb931f33 100644
--- a/clang/lib/Sema/SemaCXXCast.cpp
+++ b/clang/lib/Sema/SemaCXXCast.cpp
@@ -388,7 +388,7 @@
     return;
   }
 
-  if (!DestType->isLValueReferenceType())
+  if (!DestType->isLValueReferenceType() && !DestType->isRecordType())
     Self.DefaultFunctionArrayConversion(SrcExpr);
 
   unsigned msg = diag::err_bad_cxx_cast_generic;
@@ -1104,7 +1104,7 @@
   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