Bug 47417 - [4.6 Regression][C++0x] error: use of deleted function 'S::S(const S&)'
Summary: [4.6 Regression][C++0x] error: use of deleted function 'S::S(const S&)'
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-22 22:40 UTC by Pawel Sikora
Modified: 2011-01-25 12:51 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
source testcase. (149 bytes, text/plain)
2011-01-22 22:41 UTC, Pawel Sikora
Details
preprocessed testcase. (189.04 KB, application/bzip2)
2011-01-22 22:42 UTC, Pawel Sikora
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Sikora 2011-01-22 22:40:36 UTC
hi,

during build of my code base gcc reports an error:

(...)
include/c++/4.6.0/bits/stl_pair.h:110:17:
   error: 'constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&)
   [with _T1 = const void* const, _T2 = S, std::pair<_T1, _T2>
      = std::pair<const void* const, S>]' is implicitly deleted because
          the default definition would be ill-formed:
.../include/c++/4.6.0/bits/stl_pair.h:110:17:
   error: use of deleted function 'S::S(const S&)
Comment 1 Pawel Sikora 2011-01-22 22:41:56 UTC
Created attachment 23081 [details]
source testcase.
Comment 2 Pawel Sikora 2011-01-22 22:42:26 UTC
Created attachment 23082 [details]
preprocessed testcase.
Comment 3 Jonathan Wakely 2011-01-25 12:43:56 UTC
which version of Boost are you using? I don't know if it's fixed now but older releases (e.g. 1.42) did not support the current rvalue-reference model and unordered_map has no copy-constructor, only a move constructor:

        unordered_map(unordered_map&& other)

With the latest rvalue-reference model that cannot bind to an lvalue.

If you want to use GCC 4.6.0 and -std=c++0x then you need to use a version of Boost that can handle it.
Comment 4 Jonathan Wakely 2011-01-25 12:51:09 UTC
Boost trunk seems to have the same problem still, so this is a bug in Boost: unordered_map has no copy constructor when BOOST_HAS_RVALUE_REFS is defined

you could workaround it with a user-provided copy constructor:

S(const S& s) : m_(s.m_, s.m_.get_allocator()) { }