www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24640] New: ImportC: defines of one symbol to another are not

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 puremagic.com
          Reporter: schveiguy 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.

--
Jun 29