[Bug c/105131] New: Warning for mismatched declaration/definition with enum

rth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Apr 1 19:56:26 GMT 2022


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

            Bug ID: 105131
           Summary: Warning for mismatched declaration/definition with
                    enum
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rth at gcc dot gnu.org
  Target Milestone: ---

For a testcase such as

enum E { l = -1, z = 0, g = 1 };
int foo(void);
enum E foo(void) { return z; }

If the implementation type of 'enum E' is not 'int',
we will correctly emit an error (e.g. -fshort-enums).

It would be desirable to emit a warning in this case,
because it is probably a mistake and definitely a
portability error.


More information about the Gcc-bugs mailing list