Bug 1632 – is expression fail to work as expected

Status
RESOLVED
Resolution
INVALID
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-11-01T19:51:00Z
Last change time
2014-02-24T15:33:19Z
Assigned to
bugzilla
Creator
davidl

Comments

Comment #0 by davidl — 2007-11-01T19:51:20Z
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() { Lex.Init; writefln(Lex.myidinst); assert(is (Lex.myidinst:myid)); }
Comment #1 by smjg — 2007-11-08T16:23:58Z
What is the bug you're reporting? That the assert fails? This is correct. For an IsExpression to evaluate to true, what you give it must be a semantically valid _type_. Lex.myidinst isn't a type, it's a struct member.
Comment #2 by shro8822 — 2007-11-08T16:30:49Z
try assert(is(typeof(Lex.myidinst):myid));
Comment #3 by davidl — 2007-11-09T04:42:07Z
oh , i didn't notice isexpression is for type only