[Bug c++/97266] "enum constant in boolean context" warning seems incorrect

2020-10-02 Thread mfarazma.ext at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97266 --- Comment #6 from m farazma --- (In reply to Jonathan Wakely from comment #5) > Neither of those cases are constants, and the warning documentation (and the > actual diagnostic itself) talk about constants. > > But there's still no warning for

[Bug c++/97266] "enum constant in boolean context" warning seems incorrect

2020-10-02 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97266 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever confirmed|0

[Bug c++/97266] "enum constant in boolean context" warning seems incorrect

2020-10-01 Thread mfarazma.ext at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97266 --- Comment #4 from m farazma --- (In reply to Jonathan Wakely from comment #3) > No, the type is ValidateFlag. It has an underlying type of int8_t, but that > just means it has the same size and range of values as int8_t. It's not > actually tha

[Bug c++/97266] "enum constant in boolean context" warning seems incorrect

2020-10-01 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97266 --- Comment #3 from Jonathan Wakely --- No, the type is ValidateFlag. It has an underlying type of int8_t, but that just means it has the same size and range of values as int8_t. It's not actually that type.

[Bug c++/97266] "enum constant in boolean context" warning seems incorrect

2020-10-01 Thread mfarazma.ext at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97266 --- Comment #2 from m farazma --- (In reply to Jonathan Wakely from comment #1) > (In reply to m farazma from comment #0) > > ``` > > #include > > > > enum ValidateFlag : int8_t { > >a = 0, b , c > > }; > > > > int main(){ > > bool t =

[Bug c++/97266] "enum constant in boolean context" warning seems incorrect

2020-10-01 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97266 --- Comment #1 from Jonathan Wakely --- (In reply to m farazma from comment #0) > ``` > #include > > enum ValidateFlag : int8_t { >a = 0, b , c > }; > > int main(){ > bool t = static_cast(c); > return static_cast(t); > } > ``` > > Co