On 29 June 2016 at 00:10, Mamoru TASAKA wrote: > Hello: > > > ----- 元のメッセージ ----- >> 差出人: "Orcan Ogetbil" >> 宛先: "RPM Fusion developers discussion list" >> Cc: [email protected] >> 送信済み: 2016年6月29日, 水曜日 11:43:39 >> 件名: Re: [kaffeine] Patch for gcc6 and cmake changes >> >> On 27 June 2016 at 02:57, Leigh Scott wrote: >> > commit ed8b668fc05a7f626d5d34e779f58be200b7884c >> > Author: leigh123linux >> > Date: Mon Jun 27 07:57:17 2016 +0100 >> >> > +- char cmd[] = { 0xe0, 0x31, 0x6b, config->lnbNumber }; >> > ++ char cmd[] = { char(0xe0), 0x31, 0x6b, >> > char(config->lnbNumber) }; >> >> Hi, this looks like a compiler bug to me. I don't see anything >> ambiguous in the first line. Are we sure the compilation error is the >> intended behavior? >> >> Thanks, >> Orcan >> > > I guess kaffeine is C++ and converting 0xe0 (this is (int)224) to char is > narrowing conversion, and implicit narrowing conversion on array > initialization > is forbidden with gcc6 (i.e. C++14), so now gcc now makes the original > error. > > Regards, > Mamoru
I see. That makes sense. But I think the problem is with config->lnbNumber instead of 0xe0 (I didn't look into the source code, this is my guess). The standard [1] says (page 239): "A narrowing conversion is an implicit conversion (7.4) from an integer type or unscoped enumeration type to an integer type that cannot represent all the values of the original type, except where the source is a constant expression whose value after integral promotions will fit into the target type." Constant int 224 is within range for char as far as I know so it would fit into char. Thus, if my interpretation is right, it should not be considered narrowing conversion. Thanks for guiding to the conventions of the new standard. Cheers, Orcan [1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf
