On 11/04/2014 12:41 PM, Steven Schveighoffer wrote:

> Yep. I debugged it. It's calling toHash instead.

Yeah, you were spot on. :) I did a different experiment. I added a number of functions to the interface (before virtualCheck()) and implementations to the class:

interface I
{
// ...

    bool a();
    bool b();
    bool c();
    bool d();

    bool virtualCheck();
}


class C : I
{
// ...

    bool a() { return false; }
    bool b() { return false; }
    bool c() { return false; }
    bool d() { return false; }
}

Adding only a() calls C's precondition unconditionally (because it pushes virtualCheck() to the next slot in vtbl.)

Adding a() and b() has the same effect.

Adding a(), b(), and c() prints I.foo.in indefinitely. :)

Finally, adding a(), b(), c(), and d() seems to bring the expected behavior. :)

Ali

Reply via email to