Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-01-12 10:07:43


"Paul Mensonides" <pmenso57_at_[hidden]> writes:

> Is this well-formed:
>
> struct X {
> typedef void func_t(int);
> func_t member;
> };
>
> void X::member(int) {
> return;
> }
>
> What about:
>
> struct X {
> typedef void func_t(int) const;
> // ^^^^^
> func_t member;
> };
>
> void X::member(int) const {
> return;
> }
>
> This is the root of my question:
>
> template<class> struct test;
>
> template<class R, class C> struct test<R C::*> {
> typedef R type;
> };
>
> struct X { };
>
> test< void (X::*)(int) >::type // what type is this?
>
> Is it a function type, or is it a "member function type"?

If it's legal, it's a function type. Interestingly, MWCW seems to
think it's:

      void (void *const , const void *const , int)

But none of the other compilers seem to think it's a function type. I
know that when Howard mentioned that he thought it was natural to get
a function type by stripping the "pointer to member" part from a
pointer to member function in some committee discussion, it generated
a little bit of surprisee at least.

I can't tell what EDG thinks it is, but whatever it is, it's not a
function type.

GCC thinks it's illegal.

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk