Boost logo

Boost :

Subject: Re: [boost] C++0x trailing return type
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2010-10-14 04:42:05


On 14.10.2010 02:09, Matt Calabrese wrote:
> In experimenting with the macro, I have hit what I
> believe is either a bug in GCC or what I would consider a huge failing of
> C++0x trailing return types (someone please aid me in figuring this
> out). One of the main reasons why trailing return types are helpful is that
> the arguments to the function or function template you are writing are able
> to be refered to when forming the return type, however, when dealing with
> non-static member functions, it seems to me that you are not able to refer
> to "this" or non-static members.
This is definitely a bug somewhere.

Specifically, it is a bug in GCC, because the standard says in
[basic.lookup.unqual]p8:
"A name used in the definition of a member function of class X following
the function's declarator-id [....] shall be declared in one of the
following ways:
[...]
- shall be a member of class X or be a member of a base class of X
[...]"
The trailing return type in a member function definition is part of the
definition and is after the declarator-id, so the paragraph applies.
Furthermore, the lookup rules don't make a distinction between different
kinds of members.

Sebastian


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