[Bug c/78736] enum warnings in GCC (request for -Wenum-conversion to be added)
egallager at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Oct 19 05:23:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78736
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #18 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Jonny Grant from comment #17)
> Hello Joseph
>
> This was the test case I created. There isn't any warning output when 'a_t'
> is converted to 'int'. Or even if it was converted to an 'unsigned int'
>
> https://gcc.gnu.org/ml/gcc-help/2019-07/msg00014.html
>
>
> //-O2 -Wall -Wextra -Wconversion -Werror
>
> #include <cstddef>
> typedef enum
> {
> a = -1
> } a_t;
>
> a_t f()
> {
> return a;
> }
>
> int main()
> {
> int b = f();
> return b;
> }
While it's true that g++ prints no warnings for that testcase, I think that's
material for a separate bug. The original bug here was just to add
-Wenum-conversion for the C front-end, which has now been done, so I'm closing
this. Feel free to open new bugs for any missed cases.
More information about the Gcc-bugs
mailing list