This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12581] [3.4 Regression] gcc rejects typeof use for the return type
- From: "gabor dot greif at lucent dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Nov 2003 14:03:18 -0000
- Subject: [Bug c++/12581] [3.4 Regression] gcc rejects typeof use for the return type
- References: <20031011162654.12581.pinskia@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From gabor dot greif at lucent dot com 2003-11-12 14:03 -------
(In reply to comment #6)
> ...
>
> | I ask myself why a typeof construct cannot be an unqualified-id?
>
> Meaning?
>
> -- Gaby
>
Hmmm, I assume you do not understand what I am meaning. (Your question is a bit
overloaded :-)
Here is what I think. Let's modify my the simplified example:
struct bar
{
void setfoobar(int);
int getfoobar(void) const;
static int (bar::* const getter1)(void) const;
};
template <typename T>
T* JustAPointer(void);
typedef __typeof__(JustAPointer<bar>()->getfoobar()) GETTER_RESULT;
GETTER_RESULT (bar::* const bar::getter1)(void)
const = &bar::getfoobar;
--------------------------------------------------------------------
I strongly assume this is legal _and_ compiles.
GETTER_RESULT is a typedef-name, right?
The new C++ parser only accepts an unqualified-id in that
position, so typedef-name implies unqualified-id.
Now, by statement of Mark (comment #3), a typeof construct can be used
everywhere a typedef-name can occur. So typeof-construct implies typedef-name
(basically), and by transitiveness: typeof-construct implies unqualified-id.
Maybe I am a bit dense today, but I still cannot see what is illegal in the
example in comment #1.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12581