[cfe-commits] r40003 - /cfe/trunk/Sema/SemaExpr.cpp

Chris Lattner sabre at nondot.org
Wed Jul 18 09:00:08 PDT 2007


Author: lattner
Date: Wed Jul 18 11:00:06 2007
New Revision: 40003

URL: http://llvm.org/viewvc/llvm-project?rev=40003&view=rev
Log:
Cast to void is valid, patch by Benoit Boissinot

Modified:
    cfe/trunk/Sema/SemaExpr.cpp

Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=40003&r1=40002&r2=40003&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Wed Jul 18 11:00:06 2007
@@ -478,8 +478,9 @@
   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));
   }





More information about the cfe-commits mailing list