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

            Bug ID: 68897
           Summary: No option to disable just "warning: enumeral and
                    non-enumeral type in conditional expression"
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: maxim.yegorushkin at gmail dot com
  Target Milestone: ---

The following code:

    enum X { A };

    unsigned foo(bool b) { return b ? A : 2u; }

    int main(int ac, char**) {
        return foo(ac > 1);
    }

When compiled with `-Wall -Wextra -fdiagnostics-show-option` compiler options,
generates the following warning with g++-5.3:

    unsigned foo(bool b) { return b ? A : 2u; }
                                    ^
    warning: enumeral and non-enumeral type in conditional expression [-Wextra]

And the following warning with g++-4.9.2

    unsigned foo(bool b) { return b ? A : 2u; }
                                    ^
    warning: enumeral and non-enumeral type in conditional expression

There is no option to turn off only this particular warning without turning off
-Wextra.

Reply via email to