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
Comment #1 by razvan.nitu1305 — 2023-04-25T13:52:21Z
This seems to have been fixed, I cannot reproduce the error message, however, note that alias this for classes has been deprecated:
test.d(5): Deprecation: alias this for classes/interfaces is deprecated