Commit 210c8c21 by Changming Sun Committed by GitHub

fix: a warning found by static code analyzer (#2783)

* Update attr.h: fix a warning found by static code analyzer

Update attr.h: fix a warning found by Visual Studio static code analyzer

Severity:Warning
Code:C6323
Description: Use of arithmetic operator on Boolean type(s).
Location:	C:\src\onnxruntime\debug\pybind11\src\pybind11\include\pybind11\attr.h:547

* Update include/pybind11/attr.h

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>

* Update attr.h

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
parent f243450e
...@@ -544,7 +544,7 @@ template <typename... Extra, ...@@ -544,7 +544,7 @@ template <typename... Extra,
size_t named = constexpr_sum(std::is_base_of<arg, Extra>::value...), size_t named = constexpr_sum(std::is_base_of<arg, Extra>::value...),
size_t self = constexpr_sum(std::is_same<is_method, Extra>::value...)> size_t self = constexpr_sum(std::is_same<is_method, Extra>::value...)>
constexpr bool expected_num_args(size_t nargs, bool has_args, bool has_kwargs) { constexpr bool expected_num_args(size_t nargs, bool has_args, bool has_kwargs) {
return named == 0 || (self + named + has_args + has_kwargs) == nargs; return named == 0 || (self + named + size_t(has_args) + size_t(has_kwargs)) == nargs;
} }
PYBIND11_NAMESPACE_END(detail) PYBIND11_NAMESPACE_END(detail)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment