std::vector with forward declarated enum type

Help
Dainius
2012-09-20
2013-05-13
  • Dainius
    Dainius
    2012-09-20

    Hello,
    I have two simple code lines:

    enum EForwardDeclr;
    std::vector<EForwardDeclr> array_of_enums;
    

    I'm using MS VS 2010 developer.
    With MS version of STL this code compiles and works OK.
    But with STLport 5.2.1 I get these below added compile errors. Why STLport doesn't support this?

    VC6 developer with STLport 5.0 also working OK.

    d:\stl\stlport\stl\type_traits.h(249): error C2139: 'EForwardDeclr' : an undefined class is not allowed as an argument to compiler intrinsic type trait '__has_trivial_constructor'
    1>          d:\del\sample\sample.cpp(7) : see declaration of 'EForwardDeclr'
    1>          d:\stl\stlport\stl\_construct.h(214) : see reference to class template instantiation 'stlp_std::__type_traits<_Tp>' being compiled
    1>          with
    1>          [
    1>              _Tp=EForwardDeclr
    1>          ]
    1>          d:\stl\stlport\stl\_construct.h(220) : see reference to function template instantiation 'void stlp_std::__destroy_range<_ForwardIterator,EForwardDeclr>(_ForwardIterator,_ForwardIterator,_Tp *)' being compiled
    1>          with
    1>          [
    1>              _ForwardIterator=stlp_std::reverse_iterator<EForwardDeclr *>,
    1>              _Tp=EForwardDeclr
    1>          ]
    1>          d:\stl\stlport\stl\_vector.h(304) : see reference to function template instantiation 'void stlp_std::_Destroy_Range<stlp_std::reverse_iterator<_Iterator>>(_ForwardIterator,_ForwardIterator)' being compiled
    1>          with
    1>          [
    1>              _Iterator=EForwardDeclr *,
    1>              _ForwardIterator=stlp_std::reverse_iterator<EForwardDeclr *>
    1>          ]
    1>          d:\stl\stlport\stl\_vector.h(304) : while compiling class template member function 'stlp_std::vector<_Tp>::~vector(void)'
    1>          with
    1>          [
    1>              _Tp=EForwardDeclr
    1>          ]
    1>          d:\del\sample\sample.cpp(8) : see reference to class template instantiation 'stlp_std::vector<_Tp>' being compiled
    1>          with
    1>          [
    1>              _Tp=EForwardDeclr
    1>          ]
    1>d:\stl\stlport\stl\type_traits.h(250): error C2139: 'EForwardDeclr' : an undefined class is not allowed as an argument to compiler intrinsic type trait '__has_trivial_copy'
    1>          d:\del\sample\sample.cpp(7) : see declaration of 'EForwardDeclr'
    1>d:\stl\stlport\stl\type_traits.h(251): error C2139: 'EForwardDeclr' : an undefined class is not allowed as an argument to compiler intrinsic type trait '__has_trivial_assign'
    1>          d:\del\sample\sample.cpp(7) : see declaration of 'EForwardDeclr'
    1>d:\stl\stlport\stl\type_traits.h(252): error C2139: 'EForwardDeclr' : an undefined class is not allowed as an argument to compiler intrinsic type trait '__has_trivial_destructor'
    1>          d:\del\sample\sample.cpp(7) : see declaration of 'EForwardDeclr'
    1>d:\stl\stlport\stl\type_traits.h(253): error C2139: 'EForwardDeclr' : an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_pod'
    1>          d:\del\sample\sample.cpp(7) : see declaration of 'EForwardDeclr'