import cppyy
cppyy.cppexec("""
class Base {
public:
Base() {};
virtual void foo(int v) = 0;
void baz() {};
};
class Mid : public Base {
public:
Mid() {};
virtual void foo(int v) override = 0;
virtual void foo(float v) { };
};
class Derived : public Mid {
public:
Derived() {};
using Base::foo; // comment this line out to fix
virtual void foo(int v) override {};
virtual void foo(float v) override {};
void bar() {};
};
""")
obj = cppyy.gbl.Derived()
obj.baz()
obj.foo(5)
obj.bar()
yields
AttributeError: 'Derived' object has no attribute 'bar'
All methods that come after the superfluous using seem to be ignored, while commenting out the using seems to fix the issue. I'm not aware of this being something a compiler would complain about (the code compiles fine with clang++-17 -Wall).
The following code:
yields
All methods that come after the superfluous
using
seem to be ignored, while commenting out theusing
seems to fix the issue. I'm not aware of this being something a compiler would complain about (the code compiles fine withclang++-17 -Wall
).