Odd function resolution

Given:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class A{
public:
    Foo foo() const;
    virtual void foo(Foo &) const = 0;
};

class B : public A{
public:
    void foo(Foo &) const;
};

//...

B *b = /*...*/;
b->foo();
((A *)b)->foo();
Why does MSVC 12 complain about foo() not taking 0 arguments for the first call, but accepts the second one?
Last edited on
There is no inheritance in your example, you are converting a pointer to an unrelated type and thus getting undefined behavior.
Sorry, fixed it.
I see. Thanks.
Topic archived. No new replies allowed.