[cfe-dev] Cast to union

Eli Friedman eli.friedman at gmail.com
Wed Jan 14 20:06:22 PST 2009


On Wed, Jan 14, 2009 at 6:43 PM, Seo Sanghyeon <sanxiyn at gmail.com> wrote:
> Attached patch implements GCC cast to union extension, fixing PR2746.

Ah, I guess it was even easier than I thought.  I don't see any
serious issues with the patch.  Although, from visual inspection, I
think your patch doesn't handle the following "correctly"; I think the
call to UsualUnaryConversions at the beginning of Sema::CheckCastTypes
needs to be changed to a call to DefaultFunctionArrayConversion, or
some similar change.

int r() {
union a {unsigned short x;} x = (union a)(unsigned short)2;
}

-Eli



More information about the cfe-dev mailing list