I don't think this is a bug but certainly it is a problem.

Would you please consider it and let me know? I hope so. Thanks.

The following simple volcalc.cpp code compiles with no errors (and
works) in Windows Visual C++.
It simply sizes the "alldata" array later in the code.

With g++ v.4.3.2 instead I get the error reported hereby.
For some reason it does not like the fact that struct is declared
local. If you declare struct as global it will be working but I cannot
change the code so drastically.

I would thankfully appreciate any help (including tough critics to the code).

volcalc.cpp:26: error: template argument for ‘template<class _Alloc>
class std::allocator’ uses local type ‘main(int, char**)::series’
volcalc.cpp:26: error: trying to instantiate ‘template<class _Alloc>
class std::allocator’
volcalc.cpp:26: error: template argument 2 is invalid
volcalc.cpp:66: error: request for member ‘resize’ in ‘alldata’, which
is of non-class type ‘int’

int main(int argc, char *argv[])
{
       struct series {
               ....
       };
       int nr;
....
       vector<series> alldata;   // line 26

....    // calculate nr as int.

       alldata.resize(nr);  // line 66
}

Reply via email to