diff options
author | Changming Sun <chasun@microsoft.com> | 2021-01-13 20:14:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-13 23:14:06 -0500 |
commit | 210c8c218ff7e2828ad7c396b106cd7dfbf5e095 (patch) | |
tree | b536f29182f0f22c98c0151d0fa51b6e154466e3 | |
parent | f243450e89a57a67f3d67aa1e25868e8d4997d56 (diff) | |
download | pybind11-210c8c218ff7e2828ad7c396b106cd7dfbf5e095.tar.gz |
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>
-rw-r--r-- | include/pybind11/attr.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/pybind11/attr.h b/include/pybind11/attr.h index 0c416709..50efdc7c 100644 --- a/include/pybind11/attr.h +++ b/include/pybind11/attr.h @@ -544,7 +544,7 @@ template <typename... Extra, size_t named = constexpr_sum(std::is_base_of<arg, 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) { - 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) |