c++/3448: class method as parameter
nathan@gcc.gnu.org
nathan@gcc.gnu.org
Sun Jul 8 09:31:00 GMT 2001
Synopsis: class method as parameter
State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Sun Jul 8 09:31:45 2001
State-Changed-Why:
gcc 3.0 reports
3448.C: In function `int a(int)':
3448.C:28: warning: control reaches end of non-void function
3448.C: In function `int b(int)':
3448.C:34: warning: control reaches end of non-void function
3448.C: In function `int superf(int (*)(int))':
3448.C:39: warning: control reaches end of non-void function
3448.C: In member function `int X::csuperf(int (X::*)(int))':
3448.C:43: `6' cannot be used as a member pointer, since it is of type `int'
3448.C:44: warning: control reaches end of non-void function
3448.C: At global scope:
3448.C:46: syntax error before `:' token
3448.C:49: ISO C++ forbids declaration of `printf' with no type
3448.C:49: `int printf' redeclared as different kind of symbol
/usr/include/stdio.h:254: previous declaration of `int printf(const char*,
...)'
3448.C:49: cannot convert `const char*' to `int' in initialization
3448.C:50: parse error before `}' token
3448.C:52: syntax error before `:' token
3448.C:55: ISO C++ forbids declaration of `printf' with no type
3448.C:55: redefinition of `int printf'
3448.C:49: `int printf' previously defined here
3448.C:55: cannot convert `const char*' to `int' in initialization
3448.C:56: parse error before `}' token
the error of significance is on line 43. A pointer to member
is invoked by
(obj.*ptr) (args)
or
(obj->*ptr) (args)
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3448&database=gcc
More information about the Gcc-prs
mailing list