This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: METHOD_TYPEs
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Cc: Janus Weil <janus at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Mon, 25 May 2009 13:44:55 -0500
- Subject: Re: METHOD_TYPEs
- References: <339c37f20905251128q5a276c1dr4ba24ec8948c3ffe@mail.gmail.com>
On Mon, May 25, 2009 at 1:28 PM, Paul Richard Thomas
<paul.richard.thomas@gmail.com> wrote:
> Janus,
>
> In going through tree.def for a completely different reason, I found:
>
> /* METHOD_TYPE is the type of a function which takes an extra first
> ? argument for "self", which is not present in the declared argument list.
> ? The TREE_TYPE is the return type of the method. ?The TYPE_METHOD_BASETYPE
> ? is the type of "self". ?TYPE_ARG_TYPES is the real argument list, which
> ? includes the hidden argument for "self". ?*/
> DEFTREECODE (METHOD_TYPE, "method_type", tcc_type, 0)
>
> It might be interesting to see how these are used in g++....
They are used to repreent the type of what we call
"non-static member function" in C++.
E.g. in
struct Point {
int getX() const;
static Point make_point(int,int);
};
Point::getX will have a type represented by METHODE_TYPE,
whereas Point::make_point will have a regular FUNCTION_TYPE.
-- Gaby