[patch]: Testcase for bug in overload resolution.

Alexandre Oliva oliva@dcc.unicamp.br
Tue Jun 23 16:33:00 GMT 1998


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




More information about the Gcc-bugs mailing list