This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch]: Testcase for bug in overload resolution.
- To: oliva at dcc dot unicamp dot br
- Subject: Re: [patch]: Testcase for bug in overload resolution.
- From: Klaus-Georg Adams <Klaus-Georg dot Adams at chemie dot uni-karlsruhe dot de>
- Date: Wed, 24 Jun 1998 09:15:37 +0200
- CC: robertl at dgii dot com, egcs-bugs at cygnus dot com, egcs-patches at cygnus dot com
Alexandre is right wrt [expr.unary.op]/3. However there is something
fishy here, because if you swap the declarations of `void junk(double)' and
`void junk(float)' foo(&junk) compiles when it shouldn't.
I attach a patch to eb131.C to demonstrate.
kga
--
-------------------------------------------------------------------------
Klaus-Georg Adams Email: Klaus-Georg.Adams@chemie.uni-karlsruhe.de
Institut f. Anorg. Chemie, Lehrstuhl II Tel: 49(0)721 608 3485
Universität Karlsruhe, D-76128 Karlsruhe
-------------------------------------------------------------------------
Index: eb131.C
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/testsuite/g++.old-deja/g++.robertl/eb131.C,v
retrieving revision 1.1
diff -u -p -u -r1.1 eb131.C
--- eb131.C 1998/06/18 08:31:29 1.1
+++ eb131.C 1998/06/24 07:14:31
@@ -1,30 +1,21 @@
// Build don't link
-// 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.
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
// Reported against EGCS snaps 98/06/18.
struct a {
- a();
- void junk();
- void junk( int );
- void junk( float );
- void junk( double );
+ a();
+ void junk( float );
+ void junk( double );
- void foo( void (a::*member)(float) );
- void bar( void (*function)(float) );
-};
+ void bar( double );
+ void bar( float );
-void baz();
-void baz( int );
-void baz( float );
-void baz( double );
+ void foo( void (a::*member)(float) );
+};
a::a()
{
- foo( &junk );
- bar( &baz );
+ foo( &junk ); // ERROR: junk is an unqualified-id.
+ foo( &bar ); // ERROR: bar is an unqualified-id.
}
+