[LLVMbugs] [Bug 23304] New: map<const, const> fails copy-assignment

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 21 11:43:52 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23304

            Bug ID: 23304
           Summary: map<const, const> fails copy-assignment
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eugeni.stepanov at gmail.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

#include <string>
#include <map>

int main() {
  std::map<const std::string, const std::string> m1, m2;
  m1 = m2;
}

As I read the standard, the only requirement is that pair<const std::string,
const std::string> must be CopyInsertable, and it looks like it is.

Error text:

In file included from ../1.cc:1:
In file included from /code/llvm/build/bin/../include/c++/v1/string:439:
In file included from /code/llvm/build/bin/../include/c++/v1/algorithm:627:
/code/llvm/build/bin/../include/c++/v1/utility:299:15: error: no viable
overloaded '='
        first = __p.first;
        ~~~~~ ^ ~~~~~~~~~
/code/llvm/build/bin/../include/c++/v1/map:610:15: note: in instantiation of
member function 'std::__1::pair<const
      std::__1::basic_string<char>, const std::__1::basic_string<char>
>::operator=' requested here
        {__nc = __v.__cc; return *this;}
              ^
/code/llvm/build/bin/../include/c++/v1/__tree:1265:35: note: in instantiation
of member function
      'std::__1::__value_type<const std::__1::basic_string<char>, const
std::__1::basic_string<char> >::operator='
      requested here
                __cache->__value_ = *__first;
                                  ^
/code/llvm/build/bin/../include/c++/v1/__tree:1206:9: note: in instantiation of
function template specialization
      'std::__1::__tree<std::__1::__value_type<const
std::__1::basic_string<char>, const std::__1::basic_string<char> >,
      std::__1::__map_value_compare<const std::__1::basic_string<char>,
std::__1::__value_type<const
      std::__1::basic_string<char>, const std::__1::basic_string<char> >,
std::__1::less<const
      std::__1::basic_string<char> >, true>,
std::__1::allocator<std::__1::__value_type<const
      std::__1::basic_string<char>, const std::__1::basic_string<char> > >
     
>::__assign_multi<std::__1::__tree_const_iterator<std::__1::__value_type<const
std::__1::basic_string<char>, const
      std::__1::basic_string<char> >,
std::__1::__tree_node<std::__1::__value_type<const
std::__1::basic_string<char>,
      const std::__1::basic_string<char> >, void *> *, long> >' requested here
        __assign_multi(__t.begin(), __t.end());
        ^
/code/llvm/build/bin/../include/c++/v1/map:898:21: note: in instantiation of
member function
      'std::__1::__tree<std::__1::__value_type<const
std::__1::basic_string<char>, const std::__1::basic_string<char> >,
      std::__1::__map_value_compare<const std::__1::basic_string<char>,
std::__1::__value_type<const
      std::__1::basic_string<char>, const std::__1::basic_string<char> >,
std::__1::less<const
      std::__1::basic_string<char> >, true>,
std::__1::allocator<std::__1::__value_type<const
      std::__1::basic_string<char>, const std::__1::basic_string<char> > >
>::operator=' requested here
            __tree_ = __m.__tree_;
                    ^
../1.cc:6:6: note: in instantiation of member function 'std::__1::map<const
std::__1::basic_string<char>, const
      std::__1::basic_string<char>, std::__1::less<const
std::__1::basic_string<char> >,
      std::__1::allocator<std::__1::pair<const std::__1::basic_string<char>,
const std::__1::basic_string<char> > >
      >::operator=' requested here
  m1 = m2;

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150421/b02f4070/attachment.html>


More information about the llvm-bugs mailing list