[Bug c/78736] enum warnings in GCC (request for -Wenum-conversion to be added)
jg at jguk dot org
gcc-bugzilla@gcc.gnu.org
Sat Oct 19 14:28:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78736
--- Comment #19 from Jonny Grant <jg at jguk dot org> ---
(In reply to Eric Gallager from comment #18)
> (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.
ok, I added
Bug 92159 to add -Wenum-conversion for C++
Bug 92158 my enum test case for C and C++
More information about the Gcc-bugs
mailing list