[Issue 5934] Finite recursive templates are not allowed

2011-05-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5934



--- Comment #1 from Maksim Zholudev maxim...@gmail.com 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: ---


[Issue 5934] Finite recursive templates are not allowed

2011-05-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5934


Maksim Zholudev maxim...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #2 from Maksim Zholudev maxim...@gmail.com 2011-05-06 08:13:33 
PDT ---
*** This issue has been marked as a duplicate of issue 3869 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---