From bd986fe57e2b413666e5f93987d7f44dbbb3ea2a Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Sat, 21 May 2016 10:48:30 +0200 Subject: [PATCH] add comment about macro issues (fixes #203) --- docs/advanced.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/advanced.rst b/docs/advanced.rst index c98692161..4353536f0 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -313,6 +313,15 @@ a virtual method call. >>> call_go(c) u'meow! meow! meow! ' +.. warning:: + + Both :func:`PYBIND11_OVERLOAD` and :func:`PYBIND11_OVERLOAD_PURE` are + macros, which means that they can get confused by commas in a template + argument such as ``PYBIND11_OVERLOAD(MyReturnValue, myFunc)``. In + this case, the preprocessor assumes that the comma indicates the beginnning + of the next parameter. Use a ``typedef`` to bind the template to another + name and use it in the macro to avoid this problem. + .. seealso:: The file :file:`example/example12.cpp` contains a complete example that