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++/54506] Defaulted move constructors and move assignment operators are erroneously defined as deleted


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

--- Comment #3 from Nikolka <tsoae at mail dot ru> 2012-09-09 20:55:38 UTC ---
g++ v4.7.2 20120908 (prerelease) compiles the original example successfully,
but it fails to compile the following code:

    template <class T>
        struct A
    {
        A() {}

        A(A const volatile &&) = delete;
        A &operator =(A const volatile &&) = delete;

        template <class U>
            A(A<U> &&) {}
        template <class U>
            A &operator =(A<U> &&) { return *this; }
    };

    struct B
    {
        A<int> a;
        B() = default;
    };

    int main()
    {
        B b = B();
        b = B();
    }

Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=../target --enable-languages=c,c++
Thread model: posix
gcc version 4.7.2 20120908 (prerelease) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-shared-libgcc' '-mtune=generic'
'-march=pentiumpro'
 ../target/libexec/gcc/i686-pc-linux-gnu/4.7.2/cc1plus -quiet -v -D_GNU_SOURCE
test.cpp -quiet -dumpbase test.cpp -mtune=generic -march=pentiumpro -auxbase
test -std=c++11 -version -o /tmp/cc0973J0.s
GNU C++ (GCC) version 4.7.2 20120908 (prerelease) (i686-pc-linux-gnu)
    compiled by GNU C version 4.7.2 20120908 (prerelease), GMP version 5.0.2,
MPFR version 3.1.0, MPC version 0.8.2

test.cpp: In function âint main()â:
test.cpp:23:17: error: use of deleted function âB::B(const B&)â
test.cpp:15:12: note: âB::B(const B&)â is implicitly deleted because the
default definition would be ill-formed:
test.cpp:15:12: error: use of deleted function âconstexpr A<int>::A(const
A<int>&)â
test.cpp:2:16: note: âconstexpr A<int>::A(const A<int>&)â is implicitly
declared as deleted because âA<int>â declares a move constructor or move
assignment operator
test.cpp:24:15: error: use of deleted function âB& B::operator=(const B&)â
test.cpp:15:12: note: âB& B::operator=(const B&)â is implicitly deleted because
the default definition would be ill-formed:
test.cpp:15:12: error: use of deleted function âA<int>& A<int>::operator=(const
A<int>&)â
test.cpp:2:16: note: âA<int>& A<int>::operator=(const A<int>&)â is implicitly
declared as deleted because âA<int>â declares a move constructor or move
assignment operator


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