Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Knute_L_
Beginner
167 Views

c++11 move semantics not recognized?

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...

0 Kudos
5 Replies
Judith_W_Intel
Employee
167 Views

yes, that is correct. Our current compiler does not support generated move constructor or move assignment operators. This is supported in our currently under development compiler so you can look forward to this in our next release.
Knute_L_
Beginner
167 Views

Gotcha, thanks for the update. Don't suppose you can share the timeline on that release...?
BYUFSL
Beginner
167 Views

It seems Intel 15.0.3 still does not support this, or at least it doesn't completely. When attempting to use libc++ 3.4.0 I get this:

In file included from /apps/libcxx/3.5.0/include/c++/v1/memory(607),
                 from /apps/libcxx/3.5.0/include/c++/v1/algorithm(628),
                 from /apps/libcxx/3.5.0/include/c++/v1/string(439),
                 from /apps/libcxx/3.5.0/include/c++/v1/__locale(15),
                 from /apps/libcxx/3.5.0/include/c++/v1/ios(216),
                 from /apps/libcxx/3.5.0/include/c++/v1/iostream(38),
                 from tmp.cc(1):
/apps/libcxx/3.5.0/include/c++/v1/tuple(272): error: invalid type for defaulted constructor
      __tuple_leaf(__tuple_leaf&& __t) = default;
      ^

In file included from /apps/libcxx/3.5.0/include/c++/v1/memory(607),
                 from /apps/libcxx/3.5.0/include/c++/v1/algorithm(628),
                 from /apps/libcxx/3.5.0/include/c++/v1/string(439),
                 from /apps/libcxx/3.5.0/include/c++/v1/__locale(15),
                 from /apps/libcxx/3.5.0/include/c++/v1/ios(216),
                 from /apps/libcxx/3.5.0/include/c++/v1/iostream(38),
                 from tmp.cc(1):
/apps/libcxx/3.5.0/include/c++/v1/tuple(459): error: invalid type for defaulted constructor
      __tuple_impl(__tuple_impl&&) = default;
      ^

Can I get an update on this? Is this intended to be fixed?

Kittur_G_Intel
Employee
167 Views

@BYUSL:  With just the diagnostics it's hard to file an issue as well. Can you attach a small reproducer to this thread that ouputs those diagnostics? Also, with regard to move operations support you'll need at least gnu 4.5 or later which supports accordingly since the compiler will support the version of gnu on the system and that needs to be >= 4.5.  Can you let us know what version of GNU you're running on?
 

_Kittur

Kittur_G_Intel
Employee
167 Views

@BYUSL:
Hi, any update? A reproducer and information on the GNU version you're using would be helpful to reproduce the issue, thanks.
_Kittur

Reply