On 15/02/16 23:46 +0900, Mamoru TASAKA wrote:
Richard Shaw wrote on 02/15/2016 11:34 PM:
Can someone point me in the right direction? My package openCOLLADA is
FTBFS in rawhide with the following (repeating) error:

/builddir/build/BUILD/OpenCOLLADA-3335ac164e68b2512a40914b14c74db260e6ff7d/COLLADABaseUtils/src/COLLADABUURI.cpp:57:2:
error: narrowing conversion of '-1' from 'int' to 'char' inside { }
[-Wnarrowing]
  };

I tried using the gcc6 porting guide but I'm not qutie enough of a
programmer to understand how to apply it in this case. The offending code
is:

        const char HEX2DEC[256] = ^M
        {^M
                /*       0  1  2  3   4  5  6  7   8  9  A  B   C  D  E  F
*/^M
                /* 0 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1,^M
                /* 1 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,

<snip>

On _ARM_ (actually build failure seems to be on ARM) char is _unsigned_
by default, so converting (int)-1 to char on ARM is narrowing conversion
and C++11 forbids this on list-initialization.

You can do this when you explicitly cast, like
const char HEX2DEC[256] = { (char)-1, ..... }

Given that there are dozens of those initializers it might be more
readable to do:

static const char none = -1;
const char HEX2DEC[256] = { none, none, none, ..... }
--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org

Reply via email to