C ++ shared_ptr error with Intel 12.1.3

With gcc 4.6.1, I am using the following typedef

typedef std::shared_ptr<A> A_Ptr;

      

I included <memory>

and compiled it with -std=c++0x

and everything is fine.

With intel 12.1.3 the same code, also compiled with -std=c++0x

, gives an error

test_intel_gcc.cpp(7): error: qualified name is not allowed
  typedef std::shared_ptr<A> A_Ptr;

      

Here's a minimal example:

#include <memory>

class A;

typedef std::shared_ptr<A> A_Ptr; 

class A {
public:     
  A() {}
};

int main(int argc, char *argv[]) {
  A_Ptr ap;
  return 0;
}

      

+3


source to share


1 answer


The front end of the EDG (which the Intel compiler uses) gives this error when using an undeclared, qualified name in the typedef. So it implies std::shared_ptr

not declared in <memory>

, which implies either you forgot to use -std=c++0x

(but, as you say, you used that), or your Intel compiler is using headers from an older version of GCC (not yours 4.6.1), which does not provide shared_ptr

...

You should be sure to get the same error by changing the template ID to one that is definitely not declared:



#include <memory>

class A;

typedef std::xxx_shared_ptr<A> A_Ptr; 

      

+2


source







All Articles