From 210c8c218ff7e2828ad7c396b106cd7dfbf5e095 Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Wed, 13 Jan 2021 20:14:06 -0800 Subject: [PATCH] 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 * Update attr.h Co-authored-by: Henry Schreiner --- include/pybind11/attr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ::value...), size_t self = constexpr_sum(std::is_same::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)