From 6d816ad9af0527e63ac58d0ffe7eac29bfe56d62 Mon Sep 17 00:00:00 2001 From: "William A. Rowe Jr" Date: Mon, 16 Dec 2019 19:18:51 -0600 Subject: [PATCH] Correct test of OptionsImpl argc type (Was: Correct type for std::array size() result) (#9290) The std::array API uses std::size_t for the size() nelts count. This is a larger sized int than 'int', which causes this code to break on Windows compilation. Use the stdcxx type for conformance and portability. Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- test/server/options_impl_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/server/options_impl_test.cc b/test/server/options_impl_test.cc index efbc9cc15c2b..859ee88005f5 100644 --- a/test/server/options_impl_test.cc +++ b/test/server/options_impl_test.cc @@ -253,7 +253,7 @@ TEST_F(OptionsImplTest, OptionsAreInSyncWithProto) { TEST_F(OptionsImplTest, OptionsFromArgv) { const std::array args{"envoy", "-c", "hello"}; std::unique_ptr options = std::make_unique( - args.size(), args.data(), [](bool) { return "1"; }, spdlog::level::warn); + static_cast(args.size()), args.data(), [](bool) { return "1"; }, spdlog::level::warn); // Spot check that the arguments were parsed. EXPECT_EQ("hello", options->configPath()); } @@ -261,7 +261,7 @@ TEST_F(OptionsImplTest, OptionsFromArgv) { TEST_F(OptionsImplTest, OptionsFromArgvPrefix) { const std::array args{"envoy", "-c", "hello", "--admin-address-path", "goodbye"}; std::unique_ptr options = std::make_unique( - args.size() - 2, // Pass in only a prefix of the args + static_cast(args.size()) - 2, // Pass in only a prefix of the args args.data(), [](bool) { return "1"; }, spdlog::level::warn); EXPECT_EQ("hello", options->configPath()); // This should still have the default value since the extra arguments are