Stewart Gordon <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #2 from Stewart Gordon <> 2010-03-02 12:07:44 PST ---
(In reply to comment #1)
> The missing line number is the only bug here; the rest is an enhancement
> request. You have a recursive definition in sum.opAdd(). As soon as you do
> anything which forces opAdd to be instantiated, the recursion is detected.

I don't follow you.


b+c instantiates base.opAdd!(base)
which instantiates sum!(base, base)
so b+c is of type sum!(base, base)

a+(b+c) instantiates base.opAdd!(sum!(base, base))
which instantiates sum!(base, sum!(base, base))


a+b instantiates base.opAdd!(base)
which instantiates sum!(base, base)
so a+b is of type sum!(base, base)

(a+b)+c instantiates sum!(base, base).opAdd!(base)
which instantiates sum!(sum!(base, base), base)

The only real difference is that sum.opAdd is instantiated at all.  Are you
claiming that, because it's a member of sum, instantiating sum within it is
illegal?  How have you reached that conclusion?

> Here's a reduced test case for what you're doing:
> struct sum(A) {
>     auto blah(int a) { return .sum!(sum)(); }
> }
> sum!(int) z;

This is completely different.

sum!(int) instantiates sum!(sum!(int))
which instantiates sum!(sum!(sum!(int)))
and so on

This doesn't, or shouldn't, happen in the OP's testcase, because there's
nothing whatsoever to trigger an instantiation of sum!(sum!(base, base),

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to