Iterator bug?
Gabriel Dos Reis
gdr@integrable-solutions.net
Wed Oct 30 20:08:00 GMT 2002
"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
More information about the Gcc-bugs
mailing list