Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2003-01-12 16:15:40


----- Original Message -----
From: "Paul Mensonides" <pmenso57_at_[hidden]>

> > I can't tell what EDG thinks it is, but whatever it is, it's not a
> > function type.
>
> EDG treats it like a special type of function type. For instance, trying
to
> apply const to it yields a "applying const to a function-type" error.
Also,
> 'typeid(R).name()' yields "void (int)" which is, of course, a function
type.
> However, 'is_same<R, void (int)>::value' yields false. On the other hand,
> 'typeid(R).name()', when 'R' is from a const-qualified
> pointer-to-member-function, yields "void (int) const", which is obviously
> *not* a function type. The best I can make out is that EDG treats it as a
> "member function type".

Actually, you can make Comeau C++ crash like this (not even an ICE, just a
total crash):

#include <iostream>
#include <typeinfo>

template<class> struct get;

template<class R, class C> struct get<R C::*> {
    typedef R type;
};

struct X { };

get< int (X::*)(void) >::type function;

int main(void) {
    std::cout
        << typeid(function).name()
        << &std::endl;
    return 0;
}

Everything compiles fine until you attempt the call to typeid. Also, it
doesn't allow you to define the function either:

get< int (X::*)(void) >::type function;

int function(void) { // error
    return 0;
}

I'll talk to Daveed about what is going on here.

Paul Mensonides


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