[Boost-bugs] [Boost C++ Libraries] #10439: Flyweight: now the constructor is explicit

Subject: [Boost-bugs] [Boost C++ Libraries] #10439: Flyweight: now the constructor is explicit
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-09-01 09:05:35


#10439: Flyweight: now the constructor is explicit
---------------------------------------------+-----------------------
 Reporter: akim Demaille <akim.demaille@…> | Owner: joaquin
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: flyweight
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: |
---------------------------------------------+-----------------------
 Hi,

 The following piece of code used to work fine, but with 1.56, it now fails
 to compile with the two major free compilers.

 Thanks!

 {{{
 $ cat /tmp/foo.cc
 #include <string>
 #include <boost/flyweight.hpp>

 int main()
 {
   boost::flyweight<std::string> f = {};
 }
 $ clang++-mp-3.5 -std=c++11 -I /opt/local/include foo.cc
 foo.cc:6:33: error: chosen constructor is explicit in copy-initialization
   boost::flyweight<std::string> f = {};
                                 ^ ~~
 /opt/local/include/boost/flyweight/flyweight.hpp:195:14: note: constructor
 declared here
     explicit flyweight,
              ^
 /opt/local/include/boost/flyweight/detail/perfect_fwd.hpp:79:27: note:
 expanded from macro 'BOOST_FLYWEIGHT_PERFECT_FWD'
 template<typename... Args>name(Args&&... args) \
                           ^
 1 error generated.
 $ g++-mp-4.9 -std=c++11 -I /opt/local/include foo.cc
 foo.cc: In function 'int main()':
 foo.cc:6:38: error: converting to
 'boost::flyweights::flyweight<std::basic_string<char> >' from initializer
 list would use explicit constructor 'boost::flyweights::flyweight<T, Arg1,
 Arg2, Arg3, Arg4, Arg5>::flyweight(Args&& ...) [with Args = {}; T =
 std::basic_string<char>; Arg1 = boost::parameter::void_; Arg2 =
 boost::parameter::void_; Arg3 = boost::parameter::void_; Arg4 =
 boost::parameter::void_; Arg5 = boost::parameter::void_]'
    boost::flyweight<std::string> f = {};
                                       ^
 }}}

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