July 24, 2008 [Issue 2243] New: const bool = is(function literal), badly miscast | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2243 Summary: const bool = is(function literal), badly miscast Product: D Version: 1.033 Platform: All OS/Version: All Status: NEW Keywords: wrong-code Severity: major Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: default_357-line@yahoo.de 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. -- |
September 03, 2008 [Issue 2243] const bool = is(function literal), badly miscast | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2243 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #1 from bugzilla@digitalmars.com 2008-09-03 01:36 ------- Fixed dmd 1.035 and 2.019 -- |
Copyright © 1999-2021 by the D Language Foundation