[Issue 22876] New: importC: ambiguous cast affects expression parsing
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 11 19:04:30 UTC 2022
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 at puremagic.com
Reporter: duser at 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;
}
--
More information about the Digitalmars-d-bugs
mailing list