Article View: comp.std.c++
Article #2982Overloaded template functions
From: Jamshid Afshar
Date: Fri, 05 Jan 1996 06:25
Date: Fri, 05 Jan 1996 06:25
34 lines
1703 bytes
1703 bytes
Hi, folks, long time no see. I'm just wondering if the standard
actually disallows some code of mine containing overloaded function
templates. Fortunately (for my code, bad for me) I think this is just
another VC++ 4 bug wrt templates. Oh well, at least VC++ has improved
to the point that it handles *most* of the stuff I wrote three years
ago under BC++ 3.1.
cl -c bug2.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 10.00.5270 for 80x86
bug2.cpp(16) : error C2668: 'functor' : ambiguous call to overloaded function
(new behavior; please see help)
template<class O, class R>
void functor(O* object, R (O::*method)());
template<class O, class R, class P>
void functor(O* object, R (O::*method)(P));
class M {
public:
int f( char* );
int g( );
};
int main() {
M m;
functor(&m, &M::f);
functor(&m, &M::g); // VC++ 4 incorrectly flags this as ambiguous
return 0;
}
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<4ci9o0$l4o@bermuda.io.com>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 05 Jan 96 06:25:10 GMT Approved: fjh@cs.mu.oz.au From: jamshid@io.com (Jamshid Afshar) Newsgroups: comp.std.c++ Subject: Overloaded template functions X-Original-Date: 4 Jan 1996 22:34:08 -0600 Organization: Illuminati Online, Austin, Texas, USA Message-ID: <4ci9o0$l4o@bermuda.io.com> Summary: am I expecting too much from C++ or VC++? X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMOzEYuEDnX0m9pzZAQGP4gF/XVbgXSKJv3OZmiiYQ58uL71d+E7LNmog qbF3UJ951xpfo3AQbOWgnlYgMt0VK6Mw =P6ea