This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/69688] New: -Wsign-compare causes bogus error: size of array âuc_codeâ is not an integral constant-expression


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69688

            Bug ID: 69688
           Summary: -Wsign-compare causes bogus error: size of array
                    âuc_codeâ is not an integral constant-expression
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
                CC: jason at gcc dot gnu.org
  Target Milestone: ---

struct ScriptObjectFixture
{
    static const int code_size;
    static const char code[];
    static wchar_t uc_code[];

    ScriptObjectFixture()
    {
        for (int i = 0; i < code_size; i++)
            uc_code[i] = 0;
    }

};

const char ScriptObjectFixture::code[] = "x";
const int ScriptObjectFixture::code_size = sizeof(ScriptObjectFixture::code) -
1;
wchar_t ScriptObjectFixture::uc_code[ScriptObjectFixture::code_size];


$ g++ w.cc -c  -Wsign-compare
w.cc:17:68: error: size of array âuc_codeâ is not an integral
constant-expression
 wchar_t ScriptObjectFixture::uc_code[ScriptObjectFixture::code_size];
                                                                    ^

Without -Wsign-compare there's no diagnostic.

Caused by r230365

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]