compiler error 42
Paul Webster
paulweb@nortelnetworks.com
Thu Sep 23 08:27:00 GMT 1999
Hey-o Folks,
This is the error that I get when compiling bug.cc (attached)
% g++ -ot bug.cc
bug.cc: In function `int main()':
bug.cc:54: Internal compiler error 42.
bug.cc:54: Please submit a full bug report to `egcs-bugs@cygnus.com'.
% g++ -v
Reading specs from
D:\cygnus\CYGWIN~1\H-I586~1\bin\..\lib\gcc-lib\i586-cygwin32\egcs-2.91.57\specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
# this is using the cygwin-b20 distribution, on a winNT 4.0 platform
Later
--
Paul Webster 5E31 paulweb@nortelnetworks.com - My opinions are my own :-) -
This message brought to you by Paul (tm). Our motto: "If he's not
talkin' crazy, he's not Paul."
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <functional>
namespace paul {
namespace util {
struct equals_1st_id;
}
}
template<class T>
struct paul::util::equals_1st_id : binary_function<string, T, bool>
{
typedef typename binary_function<string, T, bool>::second_argument_type
second_argument_type;
typedef typename binary_function<string, T, bool>::first_argument_type
first_argument_type;
typedef typename binary_function<string, T, bool>::result_type
result_type;
bool operator() (const string &p1, const T &p2) const {
return (p1==((p2.first)->getId ()));
}
};
class B {
public:
B () { }
B (const string &s) : id (s) { }
B (const B &b) : id (b.id) { }
virtual ~B () { }
virtual const string getId () const { return id; }
virtual void setId (const string &s) { id = s; }
private:
string id;
};
typedef map<B*,string> bMap;
int main ()
{
bMap m;
B *b = new B ("b1");
m[b] = "TST1";
b = new B ("b2");
m[b] = "TST2";
bMap::iterator it =
find_if (m.begin (),
m.end (),
bind1st (paul::util::equals_1st_id<bMap::value_type> (), "b1"));
if( it!=m.end () )
cout << "found: " << ((*it).first)->getId ()
<< " - " << (*it).second << endl;
return 0;
}
More information about the Gcc-bugs
mailing list