Finish up r51900.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51901 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index c978aca..c384a9a 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -848,10 +848,11 @@
if (!castType->isScalarType() && !castType->isVectorType()) {
// GCC struct/union extension.
if (castType == castExpr->getType() &&
- castType->isStructureType() || castType->isUnionType())
- return Diag(LParenLoc, diag::ext_typecheck_cast_nonscalar,
- SourceRange(LParenLoc, RParenLoc));
- else
+ castType->isStructureType() || castType->isUnionType()) {
+ Diag(LParenLoc, diag::ext_typecheck_cast_nonscalar,
+ SourceRange(LParenLoc, RParenLoc));
+ return new CastExpr(castType, castExpr, LParenLoc);
+ } else
return Diag(LParenLoc, diag::err_typecheck_cond_expect_scalar,
castType.getAsString(), SourceRange(LParenLoc, RParenLoc));
}