[Issue 19533] New: "alias this" prevents "cast(void*)"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 31 17:28:12 UTC 2018


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

          Issue ID: 19533
           Summary: "alias this" prevents "cast(void*)"
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: dlang.org
          Assignee: nobody at puremagic.com
          Reporter: porton at narod.ru

The following program does not compile. I assume it should compile.

---
struct BNode { }

class UserObject {
    BNode record;
    alias record this;
    void* context() { return cast(void*)this; }
}
---

$ dlang.dmd -c test.d
test.d(5): Error: cannot cast expression this.record of type BNode to void*
$ dlang.dmd --version
DMD64 D Compiler v2.083.1

--


More information about the Digitalmars-d-bugs mailing list