digitalmars.D.bugs - [Issue 22876] New: importC: ambiguous cast affects expression parsing
- d-bugmail puremagic.com (34/34) Mar 11 2022 https://issues.dlang.org/show_bug.cgi?id=22876
https://issues.dlang.org/show_bug.cgi?id=22876 Issue ID: 22876 Summary: importC: ambiguous cast affects expression parsing Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: duser neet.fi two examples, i think they're the same bug // test1.c int printf(char *, ...); int main() { int a = 0; // dmd gives 1, other compilers -1 // bug disappears if the parentheses around (a) are removed int b = - (a) - 1; printf("%d\n", b); } // test2.c int example2() { int *a, *b; // Error: incompatible types for `(a) - (cast(char*)b)`: `int*` and `char*` // works if the parentheses around (a) are removed long diff = (char*)(a) - (char*)b; } --
Mar 11 2022