Add lvalue ref-qualified cpp_function constructors (#2213)

* added overload for l-value ref-qualified methods

* Added test.
Before, the code would have failed to build.
This commit is contained in:
Clemens Sielaff
2020-06-10 04:35:10 -07:00
committed by GitHub
parent b524008967
commit 63df87fa49
3 changed files with 46 additions and 2 deletions

View File

@@ -510,3 +510,14 @@ def test_custom_caster_destruction():
# Make sure we still only have the original object (from ..._no_destroy()) alive:
assert cstats.alive() == 1
def test_ref_qualified():
"""Tests that explicit lvalue ref-qualified methods can be called just like their
non ref-qualified counterparts."""
r = m.RefQualified()
assert r.value == 0
r.refQualified(17)
assert r.value == 17
assert r.constRefQualified(23) == 40