This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/10649: is_pointer<T> reports pointer to member function is not a pointer
- From: "Giovanni Bajo" <giovannibajo at libero dot it>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 7 May 2003 23:36:01 -0000
- Subject: Re: c++/10649: is_pointer<T> reports pointer to member function is not a pointer
- Reply-to: "Giovanni Bajo" <giovannibajo at libero dot it>
The following reply was made to PR c++/10649; it has been noted by GNATS.
From: "Giovanni Bajo" <giovannibajo@libero.it>
To: <notbob@tessellation.com>,
<gcc-bugs@gcc.gnu.org>,
<gcc-prs@gcc.gnu.org>,
<nobody@gcc.gnu.org>,
<gcc-gnats@gcc.gnu.org>
Cc:
Subject: Re: c++/10649: is_pointer<T> reports pointer to member function is not a pointer
Date: Thu, 8 May 2003 01:34:52 +0200
Robert Schwartz <robertallanschwartz@yahoo.com> wrote:
> is_pointer<int foo::*>::value (i.e. pointer to member variable) evaluates
> to true.
> If I remove the * from "int foo::*", then I get "int foo::".
> I know this isn't a valid C++ type, but a pointer to a member variable is
> still a pointer, no?
>
> If I remove the * from "int (foo::*)(void)", then I get "int
(foo::)(void)".
> I know this isn't a valid C++ type, but a pointer to a member function is
> still a pointer, no?
I'm not arguing about what is a pointer and what is not. I'm saying that a
compiler can't instantiate your template with "T = int foo::" because "int
foo::" is not a type, like you are stating yourself. This does not mean that
a pointer to a member function or a member variable is not a pointer. It
simply means that your way to detect what is a pointer and what is not a
pointer is wrong. You can check the Type Trait library within Boost, they
have metafunctions to check for every thing you can think of about types,
and they work on every compiler out there (most of them can work even
without partial specialization). It will give you an idea about how to
implement such constructs.
Giovanni Bajo