www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24504] New: ImportC: Enum declarations with a mixture of

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

          Issue ID: 24504
           Summary: ImportC: Enum declarations with a mixture of `int` and
                    `uint` literal values cause errors, when targeting
                    Windows, when debug info generation is enabled.
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: contact harrygillanders.com

When a C enum has a mixture of `int`s and `uint`s assigned to its values, if
the target is Windows, and debug info generation is enabled, the following
error will occur for each `int` member of the enum that comes before the first
`uint` member: "Error: integer constant expression expected instead of
`cast(uint)<value>`".

Test case:

 // test.c
 // REQUIRED_ARGS: -os=windows -g

 typedef enum
 {
 	HasIntAndUIntValuesInt = 0,
 	HasIntAndUIntValuesUInt = 0x80000000
 } HasIntAndUIntValues;
--
Apr 15