Non-Purity of Algebraic opEquals

Nordlöw via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 18 06:22:11 PDT 2015


Any suggestions on fixing

http://forum.dlang.org/post/mailman.5452.1422372219.9932.digitalmars-d-bugs@puremagic.com

I really need `opEquals` in

pure unittest
{
     import std.variant : Algebraic;
     import std.conv : to;

     auto x = Algebraic!(long, double)(5.to!long);
     assert(x.hasValue);
     auto y = x;
     assert(y == x);
}

to be pure. This currently fails as

t_algebraic.d(11,12): Error: pure function 
't_algebraic.__unittestL3_1' cannot call impure function 
'std.variant.VariantN!(8LU, long, 
double).VariantN.opEquals!(VariantN!(8LU, long, double)).opEquals'

Ideas anyone?


More information about the Digitalmars-d mailing list