[Bug c++/54506] Defaulted move constructors and move assignment operators are erroneously defined as deleted
tsoae at mail dot ru
gcc-bugzilla@gcc.gnu.org
Sun Sep 9 20:55:00 GMT 2012
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
More information about the Gcc-bugs
mailing list