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"
fun(std::move(a));
^
Is there any workaround?
Thank you very much.
[cpp]#include void fun(const int&a){ std::cout<

5 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

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.

thanks,
Jennifer

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

#include 
#include 

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include 

_GLIBCXX_BEGIN_NAMESPACE(std)

  // 20.2.2, forward/move
  template
    struct identity
    {
      typedef _Tp type;
    };

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

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

_GLIBCXX_END_NAMESPACE

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

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

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

Thanks,
Jennifer

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi