This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Iterator bug?
- From: "Einar Otto Stangvik" <einar at grep dot no>
- To: <bug-gcc at gnu dot org>
- Date: Thu, 31 Oct 2002 01:28:01 +0100
- Subject: Iterator bug?
uname -a
Linux monastery 2.4.19-grsec #6 SMP Tue Aug 27 14:05:00 CEST 2002 i686 unknown
gcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2/specs
Configured with: ../gcc-3.1.1/configure
Thread model: posix
gcc version 3.2
Possible bug:
If the header 'iterator' is included, the following will fail:
#include <string>
#include <algorithm>
#include <cctype>
#include <iterator>
using namespace std;
int main(int argc, char *argv[])
{
string a = "hello";
string b;
transform(a.begin(), a.end(), b.begin(), toupper);
}
Producing the following error:
g++ t.C -o t
t.C: In function `int main(int, char**)':
t.C:12: no matching function for call to `transform(
__gnu_cxx::__normal_iterator<char*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
__gnu_cxx::__normal_iterator<char*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
__gnu_cxx::__normal_iterator<char*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, <unknown type>)'
The example is merely fictional, I know the code wouldnt serve any purpose :-)
Is this a known problem, or am I doing something wrong?
Best regards,
Einar Otto Stangvik