digitalmars.D.bugs - [Issue 24154] New: ImportC: "useless" expression parsed as invalid
- d-bugmail puremagic.com (34/34) Sep 23 2023 https://issues.dlang.org/show_bug.cgi?id=24154
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 puremagic.com Reporter: dave287091 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. --
Sep 23 2023