#include <fstream> causes "call of overloaded `vector()' is ambiguous"

Gerald Pfeifer pfeifer@dbai.tuwien.ac.at
Fri Dec 22 07:01:00 GMT 2000


When compiling the following snippet with current GCC with libstdc++-v3

  #include <vector>
  #include <fstream>  // This is causing troubles!

  class STACK {
  public:
    std::vector<int> data;

    STACK() : data()
      { }
  };

I'm seeing the following error message IF AND ONLY IF <fstream>, which
is not needed at all, is #included:

  % gccvs x.cc
  x.cc: In constructor `STACK::STACK()':
  x.cc:9: call of overloaded `vector()' is ambiguous
  /sw/test/gcc/SunOS/include/g++-v3/bits/stl_vector.h:252: candidates are:
   std::vector<_Tp, _Alloc>::vector(unsigned int = 0) [with _Tp = int,
   _Alloc = std::allocator<int>]
  /sw/test/gcc/SunOS/include/g++-v3/bits/stl_vector.h:244:
   std::vector<_Tp, _Alloc>::vector(typename std::_Vector_base<_Tp,
   _Alloc>::allocator_type& = typename std::_Vector_base<_Tp,
   _Alloc>::allocator_type()) [with _Tp = int, _Alloc = std::allocator<int>]

Gerald

PS: Generating this minimal test case took me about an hour. :-(
-- 
Gerald "Jerry" pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/



More information about the Libstdc++ mailing list