[Boost-bugs] [Boost C++ Libraries] #9718: boost::container::string assignment operator problem

Subject: [Boost-bugs] [Boost C++ Libraries] #9718: boost::container::string assignment operator problem
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-02-26 16:01:10


#9718: boost::container::string assignment operator problem
---------------------------------------------+-----------------------------
 Reporter: Piotr Sulecki <piotr.sulecki@…> | Type: Bugs
   Status: new | Milestone: To Be
Component: None | Determined
 Severity: Problem | Version: Boost 1.53.0
                                             | Keywords:
---------------------------------------------+-----------------------------
 The following code compiles with std::string, but fails to with
 boost::container::string. The error message is:
 {{{
 stringtest.cpp: In function ‘int main()’:
 stringtest.cpp:21:5: error: no match for ‘operator=’ (operand types are
 â€˜Msg’ and ‘const Msg’)
    y = x; // ok with std::string, compilation error with
 boost::container::string
      ^
 stringtest.cpp:21:5: note: candidate is:
 stringtest.cpp:7:8: note: Msg& Msg::operator=(Msg&)
  struct Msg
         ^
 stringtest.cpp:7:8: note: no known conversion for argument 1 from ‘const
 Msg’ to ‘Msg&’

 }}}

 ...which suggests the assignment operator generated for Msg takes only a
 Msg reference, not a const one.

 Boost 1.53.0 under Cygwin64, compiled using g++ (GCC) 4.8.1.


 {{{
 #include <string>
 #include <boost/container/string.hpp>

 // using namespace std;
 using namespace boost::container;

 struct Msg
 {
 public:
   string msg;
 };

 int main()
 {
   const string a("hello");
   string b;
   b = a; // ok

   const Msg x;
   Msg y;
   y = x; // ok with std::string, compilation error with
 boost::container::string
   return 0;
 };
 }}}

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