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: 13 Nov 2003 08:23:28 -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-13 08:22 -------
(In reply to comment #9)
> There are two pieces of code in this PR; comment #1 and comment #2.
>
No. There is the PR description too. _That_ is the problem. As I mentioned
before, comment #1 (as viewed in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12581) is bogus IMHO. I see no
connection between the Description and comment #1. I am not intending to follow
on for reasons of impertinence, but let's not get sidetracked by those comments
and focus on the PR which deals with a PTMF type that has a typeof in the result
position. All g++ versions (going back till egcs) supported that, but gcc3.4
breaks (I did not check 3.3).
Mark, in this case your analogy typeof<-->sizeof is hinking, because a sizeof
expression cannot stand in the result-type position of a PTMF type. Also, there
is not paren-less version ot typeof.
In the meantime I found a workaround that looks like this:
-----------------------------------
...
template <typename T> struct Id { typedef T is; };
Id<__typeof__(JustAPointer<bar>()->getfoobar())>::is (bar::* const
bar::getter1)(void)
const = &bar::getfoobar;
-----------------------------------
(The trick is to use typeof inside of the <>, where the parser seems to readily
accept it.)
I can hardly believe that parsing the latter is easier that what is in the
Description :-)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12581