c++/5792: g++ fails with functions as arguments

cagdasozgenc@hotmail.com cagdasozgenc@hotmail.com
Thu Feb 28 12:16:00 GMT 2002

>Number:         5792
>Category:       c++
>Synopsis:       g++ fails with functions as arguments
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 28 09:56:00 PST 2002
>Originator:     cagdasozgenc@hotmail.com
>Release:        3.0.4
redhat linux 7.2 dual pentium 800Mhz
#include <map>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
typedef map<string,int> Index;
int main(int argc, char* argv[]) {
    Index index;
    ifstream ifs(argv[1]);
    string word;
    while(ifs >> word) {
    for(Index::const_iterator i = index.begin(); i != index.end(); ++i) {
        cout << setw(20) << i->first << " : " << i -> second << endl;
    return 0;

transform function won't accept to lower without a typecast.
for_each function will not work either for the same reason.



More information about the Gcc-bugs mailing list