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 c++/34666] New: c++0x: non-const method accepted for const&& object.


$ cat bug.cpp
template < typename T >
struct X
{
        X( X const&& o )
        {
                o.f();      // <-- accepted.
        }
        int f();
};

struct Y
{
        Y( Y const&& o )
        {
                o.f();      // <-- rejected.
        }
        int f();
};

$ /opt/gcc43/bin/g++ bug.cpp -c -std=c++0x
bug.cpp: In constructor 'Y::Y(const Y&&)':
bug.cpp:15: error: passing 'const Y' as 'this' argument of 'int Y::f()'
discards qualifiers

gcc version 4.3.0 20080102


-- 
           Summary: c++0x: non-const method accepted for const&& object.
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net


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


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