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

mfarazma.ext at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Oct 1 23:10:24 GMT 2020


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

--- Comment #4 from m farazma <mfarazma.ext at gmail dot com> ---
(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 that type.

Sorry for the confusion, I've tried creating a new variable with the following
2 types:

```
  ValidateFlag v = c;
  bool t = static_cast<bool>(v);
```

and

```
  int8_t i = c;
  bool t = static_cast<bool>(i);
```

and they both compile whiteout a warning, but using `c` itself causes the
issue.


More information about the Gcc-bugs mailing list