The attached file compiles with gcc v4.7.0 with the following compile time options:
% g++ -g2 -O3 -std=c++0x -Wall -Wextra -Winline -Werror -Winit-self -Wno-unused-function -Wno-sequence-point -Wno-inline -fPIC -Wall -W -Wcast-qual -Wpointer-arith -m64 -Woverloaded-virtual move_semantics.cpp
But I get barfage with icc v13.0.1:
/../gcc-470/include/c++/4.7.0/bits/stl_construct.h(77): error: function "A::A(const A &)" (declared at line 13 of "move_semantics.cpp") cannot be referenced -- it is a deleted function
{ ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
^
detected during:
instantiation of "void std::_Construct(_T1 *, _Args &&...) [with _T1=A, _Args=<A &>]" at line 77 of "/../gcc-470/include/c++/4.7.0/bits/stl_uninitialized.h"
instantiation of "_ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _TrivialValueTypes=false, _InputIterator=A *, _ForwardIterator=A *]" at line 119 of "/../gcc-470/include/c++/4.7.0/bits/stl_uninitialized.h"
instantiation of "_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator=A *, _ForwardIterator=A *]" at line 260 of "/../gcc-470/include/c++/4.7.0/bits/stl_uninitialized.h"
instantiation of "_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp> &) [with _InputIterator=A *, _ForwardIterator=A *, _Tp=A]" at line 283 of "/../gcc-470/include/c++/4.7.0/bits/stl_uninitialized.h"
instantiation of "_ForwardIterator std::__uninitialized_move_if_noexcept_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator &) [with _InputIterator=A *, _ForwardIterator=A *, _Allocator=std::allocator<A>]" at line 413 of "/../gcc-470/include/c++/4.7.0/bits/vector.tcc"
instantiation of "void std::vector<_Tp, _Alloc>::_M_emplace_back_aux(_Args &&...) [with _Tp=A, _Alloc=std::allocator<A>, _Args=<int &>]" at line 102 of "/../gcc-470/include/c++/4.7.0/bits/vector.tcc"
instantiation of "void std::vector<_Tp, _Alloc>::emplace_back(_Args &&...) [with _Tp=A, _Alloc=std::allocator<A>, _Args=<int &>]" at line 28 of "move_semantics.cpp"compilation aborted for move_semantics.cpp (code 2)
In a nutshell, I don't think the Intel compiler is recognizing the default move constructor. Of course, since C++11 is a bit new to me, I might be exploiting a bug in gcc and I'm actually violating the spec...


