[Issue 24154] New: ImportC: "useless" expression parsed as invalid variable declaration.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 24 01:35:57 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24154
Issue ID: 24154
Summary: ImportC: "useless" expression parsed as invalid
variable declaration.
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: ImportC
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dave287091 at gmail.com
ImportC is unable to parse a “useless” expression statement:
int main(){
int x = 3;
x; // Error: type-specifier missing for declaration of `x`
return x;
}
This almost never comes up in normal code, but when using gnu statement
expressions, the last expression in the statement expression is the value of
the statement expression and so is often one of these “useless” statements:
int main(){
int x = ({
int ret;
ret = 3;
ret; // Error: type-specifier missing for declaration of `ret`
});
return x;
}
The arm_neon.h header has many statement expressions like this.
--
More information about the Digitalmars-d-bugs
mailing list