strange Variant bug...
Lloyd Dupont
ld-REMOVE at galador.net
Wed Jun 22 03:02:14 PDT 2011
Hi Andrei,
Thanks for the quick fix and work around! :)
Mm.. unfortunately Variant.init can be on either side of the equality,
depending on the circumstances...
I'll have to learn how to get the latest D compiler from the sources.. :~
Is there a wiki HowTo somewhere?
"Andrei Alexandrescu" wrote in message
news:itqb62$2e8i$1 at digitalmars.com...
On 6/21/11 9:05 AM, Lloyd Dupont wrote:
> I have DMD2.053 on Windows 7 x64
> The following program compiled and crash on the line where I compare v7
> and v1
> =====================
> module main;
>
> import std.variant;
> import std.stdio;
>
> class Foo
> {
> }
>
> int main(string[] argv)
> {
> Variant v1 = Variant.init;
> Object o = new Foo();
> Variant v7 = Variant(o);
>
> writeln(v7 == v1);
>
> return 0;
> }
> =====================
>
> What's going on? and any work around?
> I do need to use untyped / Object Variant!
Sorry. Fixed in
https://github.com/D-Programming-Language/phobos/commit/ee5c3a39e55bc39d49fc46aed9b2c81cccdb4122.
This gave me the opportunity to also fix a not-yet-released bug that
would have been embarrassing - bool true and false would have been
printed as characters 1 and 0.
Feel free to patch your installation. A workaround is to reverse the
order of comparisons if you know the right-hand side is always initialized.
Andrei
More information about the Digitalmars-d
mailing list