www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23023] New: ImportC: useless casts are erroneously forbidden

https://issues.dlang.org/show_bug.cgi?id=23023

          Issue ID: 23023
           Summary: ImportC: useless casts are erroneously forbidden
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: me yoplitein.net

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.

--
Apr 16 2022