Skip to content

Commit 77ef03d

Browse files
vanossjwjakob
authored andcommitted
compile time check that properties have no py:arg values (#1524)
1 parent 000aabb commit 77ef03d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

include/pybind11/pybind11.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,8 @@ class class_ : public detail::generic_type {
12661266
/// Uses cpp_function's return_value_policy by default
12671267
template <typename... Extra>
12681268
class_ &def_property_static(const char *name, const cpp_function &fget, const cpp_function &fset, const Extra& ...extra) {
1269+
static_assert( 0 == detail::constexpr_sum(std::is_base_of<arg, Extra>::value...),
1270+
"Argument annotations are not allowed for properties");
12691271
auto rec_fget = get_function_record(fget), rec_fset = get_function_record(fset);
12701272
auto *rec_active = rec_fget;
12711273
if (rec_fget) {

0 commit comments

Comments
 (0)