[Issue 14331] Cannot cast(void*) a class with an alias this struct
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Sep 11 14:48:28 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14331
Martin Nowak <code at dawg.eu> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |code at dawg.eu
Summary|Can't call `destroy()` on a |Cannot cast(void*) a class
|class with `alias this` on |with an alias this struct
|a struct field |
--- Comment #1 from Martin Nowak <code at dawg.eu> ---
cat > bug.d << CODE
class Test
{
static struct S {}
S s;
alias s this;
}
void main()
{
auto p = cast(void*)(new Test);
}
CODE
dmd -c bug
----
bug2.d(11): Error: cannot cast expression (new Test).s of type S to void*
----
It is a more general problem that you cannot cast the class to void*.
--
More information about the Digitalmars-d-bugs
mailing list