Different behavior between std deque / vector in MSVCC / g ++ / icc

I have this very simple piece of code;

#include <deque>
#include <vector>

using namespace std;

class A
{
public:
    A(){};
    ~A(){};
    deque<A> my_array; // vector<A> my_array;
};

int main(void)
{
}

If I compile this code with both g ++ and icc / icpc on linux, it compiles fine, even if -Wallit does not give any warnings. If I change deque to a vector, the situation will be the same.

I would like to create this code on Windows using MSVCC (cl), but unfortunately it causes error c2027:

error C2027: use of undefined type 'A'

If, however, I change std::dequeto a std::vector, it compiles in Visual Studio 2010.

My question is: is this behavior expected for some reason? If so, why are there differences between compilers or is it a bug with g ++ / icc or MSVCC?

+5
source share
2

undefined ( std::deque, std::vector, , , , . .

g++, -Wall (, , , -W) . -D_GLIBCXX_CONCEPT_CHECKS -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC. ( , -D .)

+12

, .

, vector, deque s, . -

class vector<T> {
    T* buff;
    int size;
    // ... snip
};

, T, deque ( VS2010), T , .

0

All Articles