Missing warning on function ptr assigment?
Geir Bjarte Terum
gb@funcom.com
Fri May 14 02:47:00 GMT 1999
// Subject: Missing warning on function ptr assigment?
//
// Command line: g++ -Wall -ansi -pedantic test_function_ptr_ass.cpp
//
// Versions:
// gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
// gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
//
// Platforms:
// * Digital Unix
// * IRIX
// * Linux
class A {
public:
int f(int i) { return a = i; }
int a;
};
int g(int i) {
return int(i*1.37F);
}
int main() {
A* p = new A();
int (A::*pf)(int) = &A::f;
int (A::*pf2)(int) = A::f; // warning: assuming & on `A::f(int)
int (*pg2)(int) = &::g;
int (*pg)(int) = ::g; // no warning, is that correct?
return (p->*pf)((p->*pf2)((*pg)((*pg2)(7)))); // Just use the lot.
}
Regards
- gb -
More information about the Gcc-bugs
mailing list