public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/43916]  New: std::swap not working with -std=c++0x
@ 2010-04-28  4:39 navin dot kumar at gmail dot com
  2010-04-28  9:07 ` [Bug libstdc++/43916] " rguenth at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: navin dot kumar at gmail dot com @ 2010-04-28  4:39 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1459 bytes --]

Simple programs like the following do not compile under -std=c++0x on GCC 4.5.0
- due to the new GCC enforcement of C++0x rules regarding l-values not being
allowed to bind to "&&".

#include <iostream>
#include <math.h>

int main(int argc, char** argv)
{
    std::pair< std::string, std::string > x("hello", "world");
    std::pair< std::string, std::string > y("test", "123");
    std::swap(x, y);
    std::cout << x.first << ' ' << x.second << std::endl;
    return 0;
}

Compiler output:
In function ‘void std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&) [with
_T1 = std::basic_string<char>, _T2 = std::basic_string<char>]’:
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> >&&’
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> >]’

Likely related to bug# 43785


-- 
           Summary: std::swap not working with -std=c++0x
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: navin dot kumar at gmail dot com


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libstdc++/43916] std::swap not working with -std=c++0x
  2010-04-28  4:39 [Bug libstdc++/43916] New: std::swap not working with -std=c++0x navin dot kumar at gmail dot com
@ 2010-04-28  9:07 ` rguenth at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-28  9:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-04-28 09:07 -------


*** This bug has been marked as a duplicate of 43917 ***


-- 

rguenth at gcc dot gnu dot org changed:

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


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-28  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-28  4:39 [Bug libstdc++/43916] New: std::swap not working with -std=c++0x navin dot kumar at gmail dot com
2010-04-28  9:07 ` [Bug libstdc++/43916] " rguenth at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).