------- Comment #3 from navin dot kumar at gmail dot com  2010-04-28 17:43 
-------
Are you compiling with -std=c++0x or without?  It compiles fine without the
-std=c++0x flag.  The issue is when it is supplied.

Look at line 134 of include/c++/4.5.0/bits/stl_pair.h; inside a #ifdef
__GXX_EXPERIMENTAL_CXX0X__ tag there is the following function:

      void
      swap(pair&& __p)
      {
    using std::swap;
    swap(first, __p.first);
    swap(second, __p.second);   
      }

The compiler error stems from trying to pass a pair l-value reference to
pair&&.

Here's the compiler error with line numbers:
include/c++/4.5.0/bits/stl_pair.h: In function ‘void std::swap(std::pair<_T1,
_T2>&, std::pair<_T1, _T2>&) [with _T1 = std::basic_string<char>, _T2 =
std::basic_string<char>]’:
test.cpp:8:19:   instantiated from here
include/c++/4.5.0/bits/stl_pair.h:187:7: error: cannot bind
‘std::pair<std::basic_string<char>, std::basic_string<char> >’ lvalue to
‘std::pair<std::basic_string<char>, std::basic_string<char> >&&’
include/c++/4.5.0/bits/stl_pair.h:134:7: error:   initializing argument 1 of
‘void std::pair<_T1, _T2>::swap(std::pair<_T1, _T2>&&) [with _T1 =
std::basic_string<char>, _T2 = std::basic_string<char>, std::pair<_T1, _T2> =
std::pair<std::basic_string<char>, std::basic_string<char> >]’


-- 

navin dot kumar at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|WORKSFORME                  |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43917

Reply via email to