https://issues.dlang.org/show_bug.cgi?id=22182
Issue ID: 22182
Summary: importC: Error: expression expected, not `)` when
casting pointer with redundant parens.
Product: D
Version: D2
Hardware: x86_64
OS: Mac OS X
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
The following fails to compile:
typedef struct Bar { int x; } Bar;
int foo(Bar* b){
return ((Bar*)(b))->x;
}
int main(){
Bar b = {3};
return foo(&b);
}
The first relevant error is:
bar.c(4): Error: expression expected, not `)`
The `b` in the expression `((Bar*)(b))->x` has a redundant set of parentheses
around it. Removing them it compiles fine.
This pattern comes up a lot in the Python headers.
--