April 15 [Issue 24505] New: [REG2.108] ImportC: Function-like macros (newly translated to templates) may collide with regular symbols | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: kinke@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. -- |
Copyright © 1999-2021 by the D Language Foundation