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-09-09 10:48:12


#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:
---------------------------------------------+--------------------------

Comment (by Maxim.Yanchenko@…):

 same in boost 1.56.0 compiled with gcc4.8.2, lexical_cast.hpp:2314:16:
 {{{#!cpp
     template <typename Target, typename Source>
     inline Target lexical_cast(const Source &arg)
     {
         Target result; // <<<<< line 2314

         if (!boost::conversion::detail::try_lexical_convert(arg, result))
             BOOST_LCAST_THROW_BAD_CAST(Source, Target);

         return result;
     }
 }}}
 which I believe goes down to the line 2083:
 {{{#!cpp
             static inline bool try_convert(const Source& arg, Target&
 result) {
                 i_interpreter_type i_interpreter;

                 // Disabling ADL, by directly specifying operators.
                 if (!(i_interpreter.operator <<(arg)))
                     return false; // <<<<< line 2083

 }}}

 P.S. It looks like a GCC bug, to me, as I see in the preprocessed output
 that `throw_exception` is noreturn so GCC should see that the whole
 `lexical_cast` function is noreturn if `try_convert` returns false:
 {{{#!cpp
 template<class E> __attribute__ ((__noreturn__)) inline void
 throw_exception( E const & e )
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4946#comment:6>
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