Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-06-01 17:31:34


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?


Boost list run by bdawes at, gregod at, cpdaniel at, john at