www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23801] New: ImportC: enumeration constant does not fit in an

https://issues.dlang.org/show_bug.cgi?id=23801

          Issue ID: 23801
           Summary: ImportC: enumeration constant does not fit in an int
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

The system library libdispatch on macOS has an enumeration constant that does
not fit in an int. It is more or less defined as so:

enum {
    DISPATCH_WALLTIME_NOW = ~1ull,
};

C11 is clear on the subject - enumeration constants must fit in an int.
However, clang, gcc and likely other compilers accepted larger constants as an
extension.

Additionally, C23 has greatly changed the rules and so the above is now valid
when compiling with that standard.

--
Mar 22 2023