bfgroup / Lyra

A simple to use, composable, command line parser for C++ 11 and beyond
https://bfgroup.github.io/Lyra/
Boost Software License 1.0
483 stars 58 forks source link

Compiler warning in from_string.hpp #18

Closed gegles closed 4 years ago

gegles commented 4 years ago

When I compile my code in Release mode (higher level of Warnings enabled), I get the following:

In file included from ../../3rdparty/lyra/include/lyra/detail/parse.hpp:10,
                 from ../../3rdparty/lyra/include/lyra/detail/invoke_lambda.hpp:10,
                 from ../../3rdparty/lyra/include/lyra/detail/bound.hpp:10,
                 from ../../3rdparty/lyra/include/lyra/parser.hpp:11,
                 from ../../3rdparty/lyra/include/lyra/arg.hpp:10,
                 from ../../3rdparty/lyra/include/lyra/lyra.hpp:10,
                 from ../../cpp/echo/as_echo_main.cpp:7:
../../3rdparty/lyra/include/lyra/detail/from_string.hpp: In function 'bool lyra::detail::from_string(const S&, T&) [with S = std::basic_string<char>; T = spdlog::level::level_enum]':
../../3rdparty/lyra/include/lyra/detail/from_string.hpp:61:33: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   if (!ss.fail() && ss.eof()) { target = temp; return true; }
                                 ^~~~~~

Environment:

bash-4.2$ c++ --version
c++ (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bash-4.2$ more /etc/redhat-release
Red Hat Enterprise Linux Server release 7.7 (Maipo)
bash-4.2$