Typeinfo.compare and opCmp woes

Timon Gehr timon.gehr at gmx.ch
Mon Jul 8 08:45:05 PDT 2013


On 07/08/2013 04:55 PM, H. S. Teoh wrote:
> On Sun, Jul 07, 2013 at 10:24:12PM -0700, Jonathan M Davis wrote:
>> On Sunday, July 07, 2013 22:13:59 H. S. Teoh wrote:
>>> since due to the bug that we can't have both a template and
>>> non-template method of the same name
>>
>> I believe that Kenji fixed that bug recently.
> [...]
>
> Kenji is awesome!! So I just figured out that the reason my previous
> attempts didn't work, was because the opCmp that DMD is looking for to
> include in the typeinfo must be declared BEFORE all of the other opCmp
> overloads, otherwise it won't find it. So adding:
>
> 	int opCmp(ref const S s) const { ... }
>
> *before* the templated versions of opCmp solved the problem. It's ugly
> but at least it works.
>
> OTOH, this appears to be one of those places where order of declaration
> matters. :-(
>
>
> T
>

Bug.


More information about the Digitalmars-d mailing list