Skip to content

Commit df8494d

Browse files
authored
fix: a clang warning [-Wshadow-field-in-constructor-modified] (#2780)
* Fix a clang warning from [-Wshadow-field-in-constructor-modified] warning: modifying constructor parameter 'flag' that shadows a field of 'set_flag' [-Wshadow-field-in-constructor-modified] * Change name based on review
1 parent 14b3751 commit df8494d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/pybind11/pybind11.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1910,7 +1910,7 @@ template <return_value_policy Policy = return_value_policy::reference_internal,
19101910
template <typename InputType, typename OutputType> void implicitly_convertible() {
19111911
struct set_flag {
19121912
bool &flag;
1913-
set_flag(bool &flag) : flag(flag) { flag = true; }
1913+
set_flag(bool &flag_) : flag(flag_) { flag_ = true; }
19141914
~set_flag() { flag = false; }
19151915
};
19161916
auto implicit_caster = [](PyObject *obj, PyTypeObject *type) -> PyObject * {

0 commit comments

Comments
 (0)