[cfe-commits] [PATCH] narrowing in AltiVec literals in C++0x

Sebastian Redl sebastian.redl at getdesigned.at
Sun Sep 25 03:35:12 PDT 2011


On 24.09.2011, at 01:30, alex_rosenberg at playstation.sony.com wrote:

> [dcl.init.list] dictates errors for narrowing conversions, which triggers even for trivial AltiVec literals such as those inside <altivec.h>.
> 
> Attached is a big hammer written by a manager.

I probably invalidated this patch with my recent commits.

In any case, though, I don't think this is the right approach. First, C++11 specifies that narrowing conversions are errors in list-initialization, unless the source is a compile-time known value which fits into the target type. I don't see why an exception should be made for AltiVec literals. Second, if <altivec.h> triggers the error with literals, doesn't that mean the header is actually buggy? Third, there may be more places where this C++11 behavior may trigger errors in 3rd party headers, so I think the right approach is to disable the error in system headers, not for AltiVec literals.

Sebastian



More information about the cfe-commits mailing list