icc12 does not support std::move?

icc12 does not support std::move?

The following program works well with gcc-4.3. When I use icc12, it said:
move.cc(11): error: namespace "std" has no member "move"
Is there any workaround?
Thank you very much.
[cpp]#include void fun(const int&a){ std::cout<

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Not sure why it doesn't compiler.
On Windows if you've got VS2010 and icl, icl will compile and run fine.

It's probably a bug on Linux. I'll file a bug report for it.


I found the definition of std::move in bits/stl_move.h (line 26 of the following code).
When compiled with gcc -std=c++0x, __GXX_EXPERIMENTAL_CXX0X__ was defined, so std::move was defined.
But when compiled with icpc -std=c++0x, __GXX_EXPERIMENTAL_CXX0X__ was not defined, as a result std::move was not defined.

part of bits/stl_move.h:

#ifndef _STL_MOVE_H
#define _STL_MOVE_H 1




  // 20.2.2, forward/move
    struct identity
      typedef _Tp type;

    inline _Tp&&
    forward(typename std::identity<_Tp>::type&& __t)
    { return __t; }

    inline typename std::remove_reference<_Tp>::type&&
    move(_Tp&& __t)
    { return __t; }


#define _GLIBCXX_MOVE(_Tp) std::move(_Tp)
#define _GLIBCXX_MOVE(_Tp) (_Tp)

I had the same issue with std::move() on Linux.Apparently the -std=c++0x -D__GXX_EXPERIMENTAL_CXX0X approach didnt' work, I got lots of compilation errors regarding STL, so I hand copied the move() function into my program:

  1. template
  2. struct remove_reference
  3. { typedef _Tp type; };
  4. template
  5. struct remove_reference<_Tp&>
  6. { typedef _Tp type; };)
  7. template
  8. struct remove_reference<_Tp&&>
  9. { typedef _Tp type; };
  10. template
  11. inline typename remove_reference<_Tp>::type&&
  12. move(_Tp&& __t)
  13. { return __t; }

And my corresponding copy constructor was:

  1. template matrix:: matrix(matrix&& x)
  2. {*this = move(x);}

then I got this error message:error: an rvalue reference cannot be bound to an lvalue{ return __t; } ^detected during: instantiation of "remove_reference<_Tp>::type &&move(_Tp &&) [with _Tp=matrix &]Is my copy constructor wrong or something to do with the Intel compiler ??I was using XE12 with update 4 and compiler option:-std=c++0x -O3 -fno-omit-frame-pointer -opt-prefetch=3 -nolib-inline -inline-level=2 -parallel-Qoption,cpp,--extended_float_type,-mkl=parallelUbuntu 10.4 with gcc 4.4.3.Thanks alot !!Haining

Good news. this issue has been fixed in the Intel C++ Composer XE 2013 for Linux.

if your support service is not expired, it is free for you to upgrade it.


Leave a Comment

Please sign in to add a comment. Not a member? Join today