[Issue 24505] New: [REG2.108] ImportC: Function-like macros (newly translated to templates) may collide with regular symbols
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 15 17:37:03 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24505
Issue ID: 24505
Summary: [REG2.108] ImportC: Function-like macros (newly
translated to templates) may collide with regular
symbols
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: kinke at gmx.net
This is a snippet derived from a Windows-specific Postgres header, which cannot
be imported with DMD v2.108 anymore:
```
struct stat { int x; };
void __stat(int x, int y);
#define stat(x, y) __stat(x, y)
```
```
Error: template `c.stat(__MP21, __MP22)(__MP21 x, __MP22 y)` conflicts with
struct `c.stat` at c.c(1)
```
I think it'd be better to skip the new macro-translation in such a case, maybe
with a printed warning. Alternatively, some ugly escape hatch via e.g.
`--ignore-macro=stat` - patching C headers isn't really a feasible option.
--
More information about the Digitalmars-d-bugs
mailing list