mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-30 00:47:12 +00:00
Revert "Experiment: specify indirect bases"
This reverts commit 4f90d85f9f
.
This commit is contained in:
parent
0a0debd1ed
commit
52b799343f
@ -26,14 +26,6 @@ private:
|
|||||||
int drvd_value;
|
int drvd_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CppDrv2 : CppDrvd {
|
|
||||||
explicit CppDrv2(int value) : CppDrvd(value), drv2_value(value * 5) {}
|
|
||||||
int get_drv2_value() const { return drv2_value; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
int drv2_value;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace test_python_multiple_inheritance
|
} // namespace test_python_multiple_inheritance
|
||||||
|
|
||||||
TEST_SUBMODULE(python_multiple_inheritance, m) {
|
TEST_SUBMODULE(python_multiple_inheritance, m) {
|
||||||
@ -50,12 +42,4 @@ TEST_SUBMODULE(python_multiple_inheritance, m) {
|
|||||||
.def("reset_drvd_value", &CppDrvd::reset_drvd_value)
|
.def("reset_drvd_value", &CppDrvd::reset_drvd_value)
|
||||||
.def("get_base_value_from_drvd", &CppDrvd::get_base_value_from_drvd)
|
.def("get_base_value_from_drvd", &CppDrvd::get_base_value_from_drvd)
|
||||||
.def("reset_base_value_from_drvd", &CppDrvd::reset_base_value_from_drvd);
|
.def("reset_base_value_from_drvd", &CppDrvd::reset_base_value_from_drvd);
|
||||||
|
|
||||||
#if 1 // This works.
|
|
||||||
py::class_<CppDrv2, CppDrvd>(m, "CppDrv2")
|
|
||||||
#else // Apparent undefined behavior.
|
|
||||||
py::class_<CppDrv2, CppDrvd, CppBase>(m, "CppDrv2")
|
|
||||||
#endif
|
|
||||||
.def(py::init<int>())
|
|
||||||
.def("get_drv2_value", &CppDrv2::get_drv2_value);
|
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,6 @@ class PPCC(PC, m.CppDrvd):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class PPCC2(PC, m.CppDrv2):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def test_PC():
|
def test_PC():
|
||||||
d = PC(11)
|
d = PC(11)
|
||||||
assert d.get_base_value() == 11
|
assert d.get_base_value() == 11
|
||||||
@ -37,10 +33,3 @@ def test_PPCC():
|
|||||||
d.reset_base_value_from_drvd(30)
|
d.reset_base_value_from_drvd(30)
|
||||||
assert d.get_base_value() == 30
|
assert d.get_base_value() == 30
|
||||||
assert d.get_base_value_from_drvd() == 30
|
assert d.get_base_value_from_drvd() == 30
|
||||||
|
|
||||||
|
|
||||||
def test_PPCC2():
|
|
||||||
d = PPCC2(13)
|
|
||||||
assert d.get_drv2_value() == 65
|
|
||||||
assert d.get_drvd_value() == 39
|
|
||||||
assert d.get_base_value() == 13
|
|
||||||
|
Loading…
Reference in New Issue
Block a user