Comment #0 by default_357-line — 2008-07-24T12:24:30Z
Consider, if you will, the following code:
// one would expect this to be true.
// In fact, is returns 1, which is then .... somehow .. cast to false.
const bool foo = is(typeof(function void() { }));
pragma(msg, "Fails: ", foo.stringof);
// Now _bar is an int. And 1.
const _bar = is(typeof(function void() { }));
// And here the conversion works: bar is true.
const bool bar = _bar;
pragma(msg, "Succeeds: ", bar.stringof);
This hints at a deep and confusing bug, which luckily is unlikely to affect _much_ code, though the code it does affect, it does highly annoyingly.
Verified on GDC/Linux and DMD/win32 by h3r3tic, thanks!
This is somehow tied to the function literal: using is(typeof(0)) casts correctly to true.