[cfe-dev] Integer promotions in C-style cast expressions?

Enea Zaffanella zaffanella at cs.unipr.it
Thu Aug 13 05:02:11 PDT 2009


Eli Friedman wrote:
> On Wed, Aug 12, 2009 at 11:38 PM, Enea Zaffanella<zaffanella at cs.unipr.it> wrote:
>> However, according to our understanding of the C99 standard, the
>> operator of a C-style cast expression is not subject to promotions.
> 
> Mmm... probably just that whoever wrote the code didn't consider the
> difference between DefaultFunctionArrayConversion and
> UsualUnaryConversions in this context, since it's not particularly
> important in terms of generating the correct code.
> 
>> Function UsualUnaryConversions mixes array/function decays and integral
>> promotions. In our opinion, operands of explicit casts should be subject
>> to type decay, but not to promotions.
> 
> That sounds fine; could you send a patch to cfe-commits?
> 
> -Eli
> 
> 

Here is the (tiny) patch.
After fixing a single expected result,
it passes all clang tests.

Cheers,
Enea Zaffanella.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cast_no_promotion.diff
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090813/7231d98d/attachment.ksh>


More information about the cfe-dev mailing list