Re: [Boost-bugs] [Boost C++ Libraries] #4946: Uninitialized variable warning in lexical_cast.hpp

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4946: Uninitialized variable warning in lexical_cast.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-06-17 19:06:36


#4946: Uninitialized variable warning in lexical_cast.hpp
---------------------------------------------+--------------------------
  Reporter: Rich McKeever <richmckeever@…> | Owner: apolukhin
      Type: Bugs | Status: reopened
 Milestone: To Be Determined | Component: lexical_cast
   Version: Boost 1.55.0 | Severity: Problem
Resolution: | Keywords:
---------------------------------------------+--------------------------
Changes (by eduardorp1@…):

 * status: closed => reopened
 * version: Boost 1.44.0 => Boost 1.55.0
 * resolution: worksforme =>

Comment:

 Still happens on Mac OS X 10.9.

 {{{
 Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
 Target: x86_64-apple-darwin13.2.0

 In file included from /Users/epoyart/projects/(...)/main.cpp:15:
 In file included from /opt/local/include/boost/program_options.hpp:15:
 In file included from
 /opt/local/include/boost/program_options/options_description.hpp:13:
 In file included from
 /opt/local/include/boost/program_options/value_semantic.hpp:14:
 /opt/local/include/boost/lexical_cast.hpp:2377:24: warning: variable
 'result' may be uninitialized when used here [-Wconditional-uninitialized]
                 return result;
                        ^~~~~~
 /opt/local/include/boost/lexical_cast.hpp:2543:29: note: in instantiation
 of member function 'boost::detail::lexical_cast_do_cast<int,
 std::__1::basic_string<char> >::lexical_cast_impl' requested here
         return caster_type::lexical_cast_impl(arg);
                             ^
 In file included from /Users/epoyart/projects/(...)/main.cpp:15:
 In file included from /opt/local/include/boost/program_options.hpp:15:
 In file included from
 /opt/local/include/boost/program_options/options_description.hpp:13:
 In file included from
 /opt/local/include/boost/program_options/value_semantic.hpp:418:
 /opt/local/include/boost/program_options/detail/value_semantic.hpp:89:21:
 note: in instantiation of function template specialization
 'boost::lexical_cast<int, std::__1::basic_string<char> >' requested here
             v = any(lexical_cast<T>(s));
                     ^
 /opt/local/include/boost/program_options/detail/value_semantic.hpp:170:13:
 note: in instantiation of function template specialization
 'boost::program_options::validate<int, char>' requested here
             validate(value_store, new_tokens, (T*)0, 0);
             ^
 /opt/local/include/boost/program_options/detail/value_semantic.hpp:185:33:
 note: in instantiation of member function
 'boost::program_options::typed_value<int, char>::xparse' requested here
         typed_value<T>* r = new typed_value<T>(v);
                                 ^
 /Users/epoyart/projects/(...)/main.cpp:39:24: note: in instantiation of
 function template specialization 'boost::program_options::value<int>'
 requested here
         ("num_images", value<int>(&numImages)->default_value(0), "number
 of images to convert; 0 = all")
                        ^
 In file included from /Users/epoyart/projects/(...)/main.cpp:15:
 In file included from /opt/local/include/boost/program_options.hpp:15:
 In file included from
 /opt/local/include/boost/program_options/options_description.hpp:13:
 In file included from
 /opt/local/include/boost/program_options/value_semantic.hpp:14:
 /opt/local/include/boost/lexical_cast.hpp:2366:30: note: initialize the
 variable 'result' to silence this warning
                 Target result;
                              ^
                               = 0
 1 warning generated.
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4946#comment:5>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC