diff --git a/include/boost/python/detail/defaults_gen.hpp b/include/boost/python/detail/defaults_gen.hpp index 33cc13c8..d0e0cbb9 100644 --- a/include/boost/python/detail/defaults_gen.hpp +++ b/include/boost/python/detail/defaults_gen.hpp @@ -108,7 +108,8 @@ struct func_stubs_base {}; #define BPL_IMPL_MEM_FUNC_WRAPPER_GEN(INDEX, DATA) \ static RT BOOST_PP_CAT(func_, INDEX) \ ( \ - ClassT& obj, \ + ClassT& obj BOOST_PP_COMMA_IF( \ + BOOST_PP_ADD(BOOST_PP_TUPLE_ELEM(3, 1, DATA), INDEX)) \ BOOST_PP_ENUM \ ( \ BOOST_PP_ADD(BOOST_PP_TUPLE_ELEM(3, 1, DATA), INDEX), \ diff --git a/test/defaults.cpp b/test/defaults.cpp index 64fdd5ca..6f9e7c13 100644 --- a/test/defaults.cpp +++ b/test/defaults.cpp @@ -83,6 +83,13 @@ struct X { return format % make_tuple(a, b, c, d); } + object + bar2(int a = 0, char b = 'D', std::string c = "default", double d = 0.0) const + { + // tests zero arg member function + return format % make_tuple(a, b, c, d); + } + object foo(int a, bool b=false) const { @@ -111,6 +118,7 @@ struct X { }; BOOST_PYTHON_MEM_FUN_GENERATOR(X_bar_stubs, bar, 1, 4) +BOOST_PYTHON_MEM_FUN_GENERATOR(X_bar2_stubs, bar2, 0, 4) // tests zero arg member function BOOST_PYTHON_MEM_FUN_GENERATOR(X_foo_2_stubs, foo, 1, 2) BOOST_PYTHON_MEM_FUN_GENERATOR(X_foo_3_stubs, foo, 2, 3)