|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2005-06-01 20:16:59
On Jun 1, 2005, at 6:31 PM, Jonathan Turkanis wrote:
> Hi,
>
> Consider the following code:
>
> template<typename T, void (T::*) (int)>
> struct MemFn;
>
> struct Foo {
> template<typename Int>
> void bar(Int) { }
> };
>
> typedef MemFn<Foo, &Foo::bar> type;
>
> This compiles with VC7.1, GCC 3.4, Intel 8.0 and Comeau 4.3.3 in
> strict mode,
> but CodeWarrior 9.4 fails with the message:
>
> Error : illegal implicit member pointer conversion
> example.cpp line 9 typedef MemFn<Foo, &Foo::bar> type;
>
> Looking at 14.3.2/1, I notice while the third bullet, on function
> pointers,
> explicitly mentions templates, the fourth bullet, on pointers to
> members,
> doesn't. But perhaps pointers to function templates are covered
> implicitly.
>
> Looking at 14.3.2/5, bullet 6, I see that no conversions are applied
> to pointers
> to members. But no conversions are needed in the above example. What's
> needed is
> overload resolution, which is explicitly allowed.
>
> So who's right -- Metrowerks or everyone else?
I believe everyone else is. This snippet compiles on a more recent
internal compiler.
I looked around for a workaround, but haven't come up with one yet.
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk