Enable detection of private operator new on MSVC

MSVC 2015 Update 3 and 2017 can handle enough expression SFINAE
to make this work now.
This commit is contained in:
Dean Moldovan
2017-06-08 18:21:12 +02:00
parent 6223b18cea
commit e27ea47c87
4 changed files with 24 additions and 21 deletions

View File

@@ -98,3 +98,14 @@ def test_move_and_copy_load_optional():
assert c_c.copy_assignments == 2
assert c_c.copy_constructions == 5
assert c_m.alive() + c_mc.alive() + c_c.alive() == 0
def test_private_op_new():
"""An object with a private `operator new` cannot be returned by value"""
import pybind11_tests as m
with pytest.raises(RuntimeError) as excinfo:
m.private_op_new_value()
assert "the object is neither movable nor copyable" in str(excinfo.value)
assert m.private_op_new_reference().value == 1