September 24, 2023 [Issue 24154] New: ImportC: "useless" expression parsed as invalid variable declaration. | ||||
---|---|---|---|---|
| ||||
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. -- |
Copyright © 1999-2021 by the D Language Foundation