import std.stdio;
class myid
{
char[] buf;
this(char[] str )
{
buf = str;
}
}
struct Lex
{
static myid myidinst;
static void Init()
{
myidinst = new myid("abc");
}
}
void main()
{
assert(cast(myid)(Lex.myidinst) !is null);
}
Notice: cast(myid)(Lex.myidinst) works just correctly if there's no !is followed
bug.d(21): (type identifier : specialization) expected following is
bug.d(21): C style cast illegal, use cast(Lex.myidinst)!0
Comment #1 by smjg — 2007-11-08T16:29:26Z
Oh dear, a case of issue 34 that hasn't been fixed.
The compiler shouldn't be still trying to parse anything as a C-style cast, let alone before it's tried to parse it as legal D code.