This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]