4.1.0: pointer to member type deduction in template parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hi,

I have this code which compiles cleanly under 4.0.1.

#include <cassert>

struct A
{
    int f() const { return 1; }
};

A a;

template <class R, class S>
inline R wrap(R (S::*f)())
{
    return (a.*f)();
}

int main()
{
lineX:    assert(wrap(&A::f) == 1);
          return 0;
}

Under 4.1.0, I get the error

program.C: In function 'int main()':
program.C:linex: error: no matching function for call to 'wrap(int (A::*)()const)'

and I must modify the declaration of warp() to

inline R wrap(R (S::*f)() const)

to make it compile.

Is 4.1 right? I would have tought that 'R (S::*)() const' is included in 'R (S::*f)()'.

Thanks in advance,

	Daniel.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux