[Boost-bugs] [Boost C++ Libraries] #11599: VS2015 warns that in new_tree, not all control paths return a value

Subject: [Boost-bugs] [Boost C++ Libraries] #11599: VS2015 warns that in new_tree, not all control paths return a value
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-08-29 13:03:26


#11599: VS2015 warns that in new_tree, not all control paths return a value
-----------------------------------------+---------------------------
 Reporter: Edward Brey <edward.brey@…> | Owner: cornedbee
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: property_tree
  Version: Boost 1.59.0 | Severity: Problem
 Keywords: warnings |
-----------------------------------------+---------------------------
 In standard_callbacks::new_tree, Visual Studio 2015 can't tell from the
 assert(false) that the method will never exit after the switch statement,
 and so issues this warning:

 warning C4715:
 'boost::property_tree::json_parser::detail::standard_callbacks<boost::property_tree::basic_ptree<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > >::new_tree': not all control paths return a value

 One solution to eliminate the warning and make the code more performant
 and, in case of a bug, more repeatable, is to change the end of the method
 to use this code:

             default:
                 assert(l.k == leaf);
                 stack.pop_back();
                 return new_tree();
             }
         }

 This warning appears for both Debug and Release builds.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11599>
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:18 UTC