Skip to content

Constant expression evaluates to -1 which cannot be narrowed to type 'char' [-Wc++11-narrowing] #4

Description

@dereckson

On Debian Sid (in armv7l / arm-linux-gnueabihf architecture), with clang 3.8.1-17:

./src/base64.h:41:11: error: constant expression evaluates to -1 which cannot be narrowed to type 'char' [-Wc++11-narrowing]
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
          ^~
./src/base64.h:41:11: note: insert an explicit cast to silence this issue
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
          ^~
          static_cast<char>( )

As there are too many of them, it stops the compilation (-ferror-limit=)


I can't repro on FreeBSD 11 (amd64) with clang 3.8.0 (compilation works). I can't repro either on Debian Jessie, gcc 4.9.2.

It's not tied to clang, as I can repro on the same Debian Sid arm machine with gcc:

In file included from src/base64.cpp:29:0:
src/base64.h:56:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
 };
 ^

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions