Bug 23023 – ImportC: useless casts are erroneously forbidden

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-04-17T01:31:33Z
Last change time
2022-04-19T04:04:59Z
Assigned to
No Owner
Creator
Steven Dwy

Comments

Comment #0 by me — 2022-04-17T01:31:33Z
The following is valid C: ``` long f1(void) { return 0; } void f2(void) { (int)f1(); } ``` but ImportC rejects it with "`cast(int)f1()` has no effect" Such code often appears in macro expansions.
Comment #1 by bugzilla — 2022-04-19T04:04:59Z
This works with the latest compiler.