www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14677] New: cast correctness not checked inside is(typeof())

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

          Issue ID: 14677
           Summary: cast correctness not checked inside is(typeof())
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: public dicebot.lv

```
void main()
{
    void* x;
    // Error: e2ir: cannot cast x of type void* to type int[30]
    auto y = cast (int[30]) x;
    // But this passes
    static assert (is(typeof({ auto y = cast(int[30])x; })));
}
```

Looks like correctness of cast is checked after normal semantic phase and thus
ignored by `is(typeof())`

--
Jun 10 2015