mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user