[Bug c++/55017] New: [C++11] Rvalue-reference member should cause copy constructor not deleted, but still declared

daniel.kruegler at googlemail dot com gcc-bugzilla@gcc.gnu.org
Mon Oct 22 07:54:00 GMT 2012


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

             Bug #: 55017
           Summary: [C++11] Rvalue-reference member should cause copy
                    constructor not deleted, but still declared
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com


Using gcc 4.8.0 20121014 (experimental) with the compiler flags

-Wall -pedantic -std=c++11

the following code is incorrectly accepted:

//----------------------
struct S {
  int&& rr;
  S(int&& rr) : rr(static_cast<int&&>(rr)) {}
};

S s1(13);
S s2 = s1; // Should be rejected
//----------------------

This code should be rejected, because a non-static rvalue-reference member
causes the copy-constructor to be deleted as of 12.8 p11 b5. (Note: Even though
12.8 is currently under investigation bei CWG, there are no intentions to
change this part of the wording)



More information about the Gcc-bugs mailing list