This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Iterator bug?
But why does it work when the iterator header isn't included? And on gcc 2.95 it appears to compile either way.
Regards,
Einar
----- Original Message -----
From: "Gabriel Dos Reis" <gdr@integrable-solutions.net>
To: "Einar Otto Stangvik" <einar@grep.no>
Cc: <bug-gcc@gnu.org>
Sent: Thursday, October 31, 2002 4:06 AM
Subject: Re: Iterator bug?
> "Einar Otto Stangvik" <einar@grep.no> writes:
>
> | 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);
>
> As writte,, this is not a bug in the compiler; and it is a known issue
> in the C++ community: the above construct is not required to work.
> The point being that std::toupper is an overloaded function and C++
> has no type for the address of an overloaded function. You ought to
> disambiguate by hand.
>
> -- Gaby
>
>