This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11235] pointer to memer function
- From: "pinskia at physics dot uc dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Jun 2003 14:54:20 -0000
- Subject: [Bug c++/11235] pointer to memer function
- References: <20030618135348.11235.adrin_jalali@yahoo.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11235
------- Additional Comments From pinskia at physics dot uc dot edu 2003-06-18 14:54 -------
Subject: Re: pointer to memer function
because the function which you are passing to fun is declared as const
and that it wants a non const version, try the following:
struct test
{
bool f(int *i) const {return *i > 10; }
};
void fun(bool (test::*) (int *) const );
int main(void)
{
test temp;
fun(&test::f);
}
Thanks,
Andrew Pinski
On Wednesday, Jun 18, 2003, at 10:49 US/Eastern, adrin_jalali at yahoo
dot com wrote:
> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT*
> gcc-bugs@gcc.gnu.org.
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11235
>
>
>
> ------- Additional Comments From adrin_jalali at yahoo dot com
> 2003-06-18 14:49 -------
> Subject: Re: pointer to memer function
>
> that's true, but this code can't be compiled too, why?
>
> struct test
> {
> bool f(int *i) const {return *i > 10; }
> };
>
> void fun(bool (test::*)(int *));
>
> int main(void)
> {
> test temp;
> fun(temp.f); -> here can't be compiled again.
> }
>
> --- bangerth at dealii dot org <gcc-bugzilla@gcc.gnu.org> wrote:
>> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT*
>> gcc-bugs@gcc.gnu.org.
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11235
>>
>>
>> bangerth at dealii dot org changed:
>>
>> What |Removed |Added
>> ----------------------------------------------------------------------
>> ------
>> Status|UNCONFIRMED |RESOLVED
>> Resolution| |INVALID
>>
>>
>> ------- Additional Comments From bangerth at dealii dot org
>> 2003-06-18 14:01
>> -------
>> gcc is just right. A member function has type
>> bool (test::*) (int *)
>> and so doesn't match the argument of fun().
>>
>> W.
>>
>>
>>
>> ------- You are receiving this mail because: -------
>> You reported the bug, or are watching the reporter.
>
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
>
>