strange Variant bug...

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jun 21 07:47:01 PDT 2011


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