Recursive template expansion

Robert Jacques sandford at jhu.edu
Mon Mar 1 18:52:40 PST 2010


On Mon, 01 Mar 2010 12:47:49 -0500, Philippe Sigaud  
<philippe.sigaud at gmail.com> wrote:
[snip]

>> Still I would like to know the reason for my original failure,  
>> especially
>> since the compiler error message did not contain any line number  
>> whatsoever.
>> Getting this kind of error message in a large project must be really  
>> ugly to
>> solve, even if the workaround is so straightforward...
>>
>
> What bugs (!) me is that a+(b+c) didn't create an error, whereas (a+b)+c
> did... I first tried to define opAdd_r so that the compiler could try
> c.opAdd_r((a+b)), but to no avail...

Well, it makes sense. a+(b+c) is base.op_Add(sum), which is okay. And  
opApp will always be tried before opAdd_r, and so DMD fails.



More information about the Digitalmars-d mailing list