File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1400,3 +1400,26 @@ class Foo {
14001400 foo = ns .Foo ()
14011401 with raises (cppyy .gbl .std .logic_error ):
14021402 foo .bar ()
1403+
1404+ def test47_initializer_list_fail (self , capfd ):
1405+ """Conversion to intializer_list requires default constructor"""
1406+
1407+ import cppyy
1408+
1409+ cppyy .cppdef ("""\
1410+ namespace regression_test47 {
1411+ std::size_t size = 0;
1412+ struct IntWrapper { IntWrapper(int i) : fInt(i) {} int fInt; };
1413+ void f(std::initializer_list<IntWrapper> l) {}
1414+ void f(std::vector<IntWrapper> l) { size = l.size(); }
1415+ }""" )
1416+
1417+ r47 = cppyy .gbl .regression_test47
1418+
1419+ assert r47 .size == 0
1420+
1421+ r47 .f ([1 ])
1422+ assert r47 .size == 1
1423+ (out , err ) = capfd .readouterr ()
1424+ assert out == ""
1425+ assert err == ""
You can’t perform that action at this time.
0 commit comments