[Issue 24639] New: ImportC: defines of negative constants not detected for enum conversion

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 30 03:19:20 UTC 2024


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

          Issue ID: 24639
           Summary: ImportC: defines of negative constants not detected
                    for enum conversion
           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

file2.c:
#define blah -1
#define blah2 (-1)
#define blah3 (0 - 1)

file1.d:
import file2;

unittest
{
   assert(blah == -1); // can't find blah
   assert(blah2 == -1); // can't find blah2
   assert(blah3 == -1); // OK!
}

I think the issue is that the parser does not see the `-` sign as a number, and
so skips this definition. But it does work for an expression that starts with a
number inside parentheses.

--


More information about the Digitalmars-d-bugs mailing list