This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [patch]: Testcase for bug in overload resolution.


Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de> writes:

> // The call to a::foo() generates an error:
> // eb131.C: In method `a::a()':
> // eb131.C:26: no matching function for call to `a::foo (void (a::*)(double))'
> // eb131.C:15: candidates are: a::foo(void (a::*)(float))
> // According to [over.over] in the CD2, &junk should resolve in this context.

IMO, the error message is misleading, but the testcase is wrong.
`&junk' is ill-formed, even inside the scope of `struct a', because
`junk' is not a static member function.  In order to form a pointer to 
member, you must always qualify it [expr.unary.op]/3.

> 	foo( &junk );

The test case compiles correctly if you use `&a::junk'.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]