]> granicus.if.org Git - clang/commitdiff
Cast to void is valid, patch by Benoit Boissinot
authorChris Lattner <sabre@nondot.org>
Wed, 18 Jul 2007 16:00:06 +0000 (16:00 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 18 Jul 2007 16:00:06 +0000 (16:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40003 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/SemaExpr.cpp

index 6439e48e9d58fe2c30b0a65f65efe18f87730a04..044fb63bf081158cbddc69fed1f3e8985b43e86f 100644 (file)
@@ -478,8 +478,9 @@ ParseCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
   Expr *castExpr = static_cast<Expr*>(Op);
   QualType castType = QualType::getFromOpaquePtr(Ty);
 
-  // C99 6.5.4p2: both the cast type and expression type need to be scalars.
-  if (!castType->isScalarType()) { 
+  // C99 6.5.4p2: the cast type needs to be void or scalar and the expression
+  // type needs to be scalar.
+  if (!castType->isScalarType() && !castType->isVoidType()) { 
     return Diag(LParenLoc, diag::err_typecheck_cond_expect_scalar, 
                 castType.getAsString(), SourceRange(LParenLoc, RParenLoc));
   }