Bug 22758 – ImportC: parenthesized expression confused with cast-expression

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-02-10T11:03:35Z
Last change time
2022-02-12T07:49:01Z
Keywords
ImportC, pull, rejects-valid
Assigned to
No Owner
Creator
dave287091

Comments

Comment #0 by dave287091 — 2022-02-10T11:03:35Z
A reduced snippet of C code from sqlite: void foo(unsigned* aData){ unsigned s = ( (((aData[0])&0x000000FF)<<24) + (((aData[0])&0x0000FF00)<<8) + (((aData[0])&0x00FF0000)>>8) + (((aData[0])&0xFF000000)>>24) ); } ty.c(2): Error: variable `aData` is used as a type ty.c(1): variable `aData` is declared here ty.c(2): Error: variable `aData` is used as a type ty.c(1): variable `aData` is declared here ty.c(2): Error: variable `aData` is used as a type ty.c(1): variable `aData` is declared here ty.c(2): Error: variable `aData` is used as a type ty.c(1): variable `aData` is declared here
Comment #1 by bugzilla — 2022-02-11T08:51:34Z
A smaller version: void foo(unsigned *aData) { unsigned s = (aData[0]) + 1; }
Comment #2 by dlang-bot — 2022-02-12T06:01:09Z
@WalterBright created dlang/dmd pull request #13646 "fix Issue 22758 - ImportC: parenthesized expression confused with cas…" fixing this issue: - fix Issue 22758 - ImportC: parenthesized expression confused with cast-expression https://github.com/dlang/dmd/pull/13646
Comment #3 by dlang-bot — 2022-02-12T07:49:01Z
dlang/dmd pull request #13646 "fix Issue 22758 - ImportC: parenthesized expression confused with cas…" was merged into master: - e082c2ee5232e9a9f66c375d88d33b4b5265ded8 by Walter Bright: fix Issue 22758 - ImportC: parenthesized expression confused with cast-expression https://github.com/dlang/dmd/pull/13646