error in g++, snapshot 20010108
Maurizio Loreti
loreti@pd.infn.it
Wed Jan 10 05:32:00 GMT 2001
Here follows a copy of a post on the newsgroups gnu.g++.help
and gnu.g++.bugs; hope that helps.
Sender: loreti@mlinux.pd.infn.it
Newsgroups: gnu.g++.help,gnu.g++.bugs
Subject: error in g++, snapshot 20010108
From: Maurizio Loreti <loreti@pd.infn.it>
Date: 10 Jan 2001 14:29:55 +0100
--text follows this line--
Hello -
In my relentless search for an usable snapshot of a current g++ with a
modern standard library, I have downloaded and installed the last
snapshot dated 20010108. When I tried to compile a program of mine, I
had what I think is due to a bug in the standard library. Here it is,
reduced to a minimal length of 7 lines of code:
MLO@mlinux 14 $ cat bar.cxx
#include <memory>
#include <string>
#include <vector>
#include <fstream>
int main() {
std::auto_ptr< std::vector<std::string> > a( new std::vector<std::string> );
}
MLO@mlinux 15 $ g++ -o bar bar.cxx
bar.cxx: In function `int main()':
bar.cxx:7: call of overloaded `vector()' is ambiguous
/usr/local/gcc/include/g++-v3/bits/stl_vector.h:252: candidates are:
std::vector<_Tp, _Alloc>::vector(unsigned int = 0) [with _Tp = string,
_Alloc = std::allocator<string>]
/usr/local/gcc/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 = string, _Alloc =
std::allocator<string>]
MLO@mlinux 16 $
In case somebody wonders why I have #included <fstream>, well, if you
do not #include <fstream> the bug disappears :-)
I hope that bug report may be useful to the developers of g++ and/or
of the standard library. And I hope to find some week an usable
snapshot, if not a brand new g++ version 3.
--
Maurizio Loreti http://www.pd.infn.it/~loreti/mlo.html
Univ. of Padova, Dept. of Physics - Padova, Italy loreti@pd.infn.it
More information about the Libstdc++
mailing list