Bug 1633 – Nonsensical "C style cast illegal" message with !is

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-11-01T19:57:00Z
Last change time
2014-02-24T15:31:31Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
davidl

Comments

Comment #0 by davidl — 2007-11-01T19:57:34Z
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.
Comment #2 by bugzilla — 2008-09-03T01:33:45Z
Fixed dmd 1.035 and 2.019