[Issue 24640] New: ImportC: defines of one symbol to another are not converted to enums

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 30 03:49:39 UTC 2024


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

          Issue ID: 24640
           Summary: ImportC: defines of one symbol to another are not
                    converted to enums
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: schveiguy at gmail.com

importc.c:
#define A 1
#define B A
#define C (A)
#define D (B)

file.d:
import importc;
static assert(A == B); // undefined identifier: B
static assert(A == C); // OK!
static assert(A == D); // undefined identifier: B

I'm uncertain whether D should work, if B does not work. But I think this would
require somehow expanding the macro for B before translating the code.

--


More information about the Digitalmars-d-bugs mailing list