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

            Bug ID: 79215
           Summary: -Wpedantic doesn't warn if UINT64_MAX is used as enum
                    constant
           Product: gcc
           Version: 5.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wellnhofer at aevum dot de
  Target Milestone: ---

When compliling the program

    #include <stdint.h>

    enum e {
        v = UINT64_MAX
    };

with -Wpedantic, no warning is emitted. When I change UINT64_MAX to
18446744073709551615ULL, I get

    warning: ISO C restricts enumerator values to range of ‘int’ [-Wpedantic]

as expected. It looks like the reason is the preprocessor output

    enum e {
        v =
    # 4 "test.c" 3 4
           (18446744073709551615ULL)

    # 5 "test.c"

According to the documentation, the '3' flag "indicates that the following text
comes from a system header file, so certain warnings should be suppressed."

Reply via email to