http://d.puremagic.com/issues/show_bug.cgi?id=5934
--- Comment #1 from Maksim Zholudev 2011-05-06 07:55:47
PDT ---
The following code works, but such workarounds are annoying:
--
struct Foo
{
auto opUnary(string op)()
if(op == "-")
{
return Negation!(typeof(this))(this);
}
}
struct Negation(T)
{
T statement;
auto opUnary(string op)()
if(op == "-")
{
return MakeNeg(this); // The return type is "Negation!(Negation!(T))"
}
}
// Function that makes the recursion implicit
auto MakeNeg(T)(T stat)
{
return Negation!(T)(stat);
}
void main()
{
Foo a;
auto b = -a; // no errors
auto c = -(-a); // no errors
}
--
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---