This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/41249] New: [c++0x] std::list<>::splice() binding rvalue-reference to lvalue problem


This bug is proably a followup to #40486: [c++0x] rvalue-references no longer
bind to lvalues

std::list<>::splice() no longer works in trunk in c++0x mode:

=========== 8< ==========
#include "list"

int main()
{
        std::list<int> l;
        l.insert(l.end(), 1);
        l.insert(l.end(), 2);
        std::list<int>::iterator it = l.insert(l.end(), 3);
        l.splice(l.begin(), l, it);
}
=========== >8 ==========

This code works fine in 3.4 to 4.5 and also in 4.3/4.4 in c++0x mode, but
compilation fails in 4.5 in c++0x mode:

$ g++-trunk -W -Wall -std=c++0x -v splicebug45x.cpp
...
GNU C++ (GCC) version 4.5.0 20090902 (experimental) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.5.0 20090902 (experimental), GMP version
4.3.1, MPFR version 2.4.1-p2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: dc8948bf5433867ce447f5693e715548
splicebug45x.cpp: In function ?int main()?:
splicebug45x.cpp:9:27: error: cannot bind ?std::list<int>? lvalue to
?std::list<int>&&?
/opt/software/x86_64/gcc-trunk/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/bits/stl_list.h:1178:7:
error:   initializing argument 2 of ?void std::list<_Tp,
_Alloc>::splice(std::list<_Tp, _Alloc>::iterator, std::list<_Tp, _Alloc>&&,
std::list<_Tp, _Alloc>::iterator) [with _Tp = int, _Alloc =
std::allocator<int>, std::list<_Tp, _Alloc>::iterator =
std::_List_iterator<int>]?


-- 
           Summary: [c++0x] std::list<>::splice() binding rvalue-reference
                    to lvalue problem
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc at abeckmann dot de


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]