@@ -2158,16 +2158,20 @@ template <class T> function get_overload(const T *this_ptr, const char *name) {
2158
2158
}
2159
2159
\endrst */
2160
2160
#define PYBIND11_OVERLOAD_NAME (ret_type, cname, name, fn, ...) \
2161
- PYBIND11_OVERLOAD_INT (PYBIND11_TYPE (ret_type), PYBIND11_TYPE (cname), name, __VA_ARGS__) \
2162
- return cname::fn (__VA_ARGS__)
2161
+ do { \
2162
+ PYBIND11_OVERLOAD_INT (PYBIND11_TYPE (ret_type), PYBIND11_TYPE (cname), name, __VA_ARGS__) \
2163
+ return cname::fn (__VA_ARGS__) \
2164
+ } while (false )
2163
2165
2164
2166
/* * \rst
2165
2167
Macro for pure virtual functions, this function is identical to :c:macro:`PYBIND11_OVERLOAD_NAME`, except that it
2166
2168
throws if no overload can be found.
2167
2169
\endrst */
2168
2170
#define PYBIND11_OVERLOAD_PURE_NAME (ret_type, cname, name, fn, ...) \
2169
- PYBIND11_OVERLOAD_INT (PYBIND11_TYPE (ret_type), PYBIND11_TYPE (cname), name, __VA_ARGS__) \
2170
- pybind11::pybind11_fail (" Tried to call pure virtual function \" " PYBIND11_STRINGIFY (cname) " ::" name " \" " );
2171
+ do { \
2172
+ PYBIND11_OVERLOAD_INT (PYBIND11_TYPE (ret_type), PYBIND11_TYPE (cname), name, __VA_ARGS__) \
2173
+ pybind11::pybind11_fail (" Tried to call pure virtual function \" " PYBIND11_STRINGIFY (cname) " ::" name " \" " ); \
2174
+ } while (false )
2171
2175
2172
2176
/* * \rst
2173
2177
Macro to populate the virtual method in the trampoline class. This macro tries to look up the method
0 commit comments