[cfe-dev] Narrowing in initalizer lists

Sebastian Redl sebastian.redl at getdesigned.at
Fri Oct 14 08:33:36 PDT 2011

On 14.10.2011, at 15:08, Christopher Jefferson wrote:

> I just wanted to quickly check this bug (which occurs in boost).
> clang -std=c++0x forbids:
> int f();
> unsigned int vals[] = {f(),f()};
> As in initalizer lists, int cannot be narrowed to int.
> Just wanted to double check, is clang definitely in the right here?

Yes. int -> unsigned int is a narrowing conversion, and thus forbidden in this context.


More information about the cfe-dev mailing list