[Issue 14677] New: cast correctness not checked inside is(typeof())

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 10 09:03:11 PDT 2015


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 at puremagic.com
          Reporter: public at 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())`

--


More information about the Digitalmars-d-bugs mailing list