[cfe-dev] "expression result unused" in comma expression

Chris Lattner clattner at apple.com
Tue Aug 28 11:30:30 PDT 2007


>> So the y+2 is unused.  I will fix the diagnostic to be more precise.
>
> Thanks for pointing this out.  On a related matter, it does appear  
> that this check doesn't handle statement expressions (unless I'm,  
> quite possibly, also reading this wrong!):
>
> int maxval_stmt_expr(int x, int y) {
>   return ({int _a = x, _b = y; _a > _b ? _a : _b; });
> }
>
> warning: expression result unused
>   return ({int _a = x, _b = y; _a > _b ? _a : _b; });
>                                ^~~~~~~~~~~~~~~~~
>
> (it's pointing to the ternary expression)

You are right, it doesn't handle them yet.  This is a bug in the  
warning that I haven't addressed yet.

-Chris



More information about the cfe-dev mailing list