[cfe-dev] fix Sema/unused-expr.c failing on r39999
Chris Lattner
clattner at apple.com
Wed Jul 18 09:01:43 PDT 2007
On Jul 18, 2007, at 3:21 AM, Benoit Boissinot wrote:
> I needed the following patch so that test/Sema/unused-expr.c does not
> fail:
Applied, thanks! With future patches, please include them as
attachments to the email. This one applied fine, but I've had
trouble with inline attachments in the past.
Thanks again,
-Chris
> --
> void is a valid cast type
>
> Index: Sema/SemaExpr.cpp
> ===================================================================
> --- Sema/SemaExpr.cpp (revision 39996)
> +++ Sema/SemaExpr.cpp (working copy)
> @@ -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));
> }
> --
> :wq
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list