public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ehrhardt at mathematik dot uni-ulm dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/12581] [3.4 Regression ] gcc rejects typeof use for the return type Date: Thu, 16 Oct 2003 16:14:00 -0000 [thread overview] Message-ID: <20031016161355.17421.qmail@sources.redhat.com> (raw) In-Reply-To: <20031011162654.12581.pinskia@gcc.gnu.org> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12581 ------- Additional Comments From ehrhardt at mathematik dot uni-ulm dot de 2003-10-16 16:13 ------- The testcase basically reduces to: int f(); __typeof__ (f)() x; Depending on the priority of the __typeof__ operator relative to the postfix () operator this is valid or not. The two posibilities are: (A) declare x as int ( == __typeof__ (f ()) ) (B) get type of f (function returning int) and try to apply the postfix () to this which is impossible. (A) would make __typeof__ similar to sizeof, (B) would make it similar to typeid in C++. The downside of (A) (this is what we currently do) is that some potentially useful applications of __typeof__ are impossible, e.g. the one in the original report or this one which is similar: int f (); __typeof__ (f()) (*x) (void); where we try do declare x as a pointer to a function returning int. However, this is rejected, because due to the higher priority of () it is parsed as __typeof__ ( (f()) (*x) (void) ); i.e. we try to get the type of the invalid unary expression (f()) (*x) (void) and do nothing with the result. Note that it is impossible to get the desired result by placing parentheses in this declaration. IMHO, this needs a language lawyer. A work around is of course to use a typedef. regards Christian
next prev parent reply other threads:[~2003-10-16 16:14 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-10-11 16:26 [Bug c++/12581] New: " pinskia at gcc dot gnu dot org 2003-10-13 3:27 ` [Bug c++/12581] " pinskia at gcc dot gnu dot org 2003-10-16 16:14 ` ehrhardt at mathematik dot uni-ulm dot de [this message] 2003-10-22 1:25 ` [Bug c++/12581] [3.4 Regression] " bangerth at dealii dot org 2003-10-22 1:27 ` bangerth at dealii dot org 2003-11-12 3:14 ` mmitchel at gcc dot gnu dot org 2003-11-12 3:16 ` mmitchel at gcc dot gnu dot org 2003-11-12 12:35 ` gabor dot greif at lucent dot com 2003-11-12 12:43 ` gdr at integrable-solutions dot net 2003-11-12 14:03 ` gabor dot greif at lucent dot com 2003-11-12 14:29 ` gdr at integrable-solutions dot net 2003-11-12 16:14 ` mmitchel at gcc dot gnu dot org 2003-11-13 8:23 ` gabor dot greif at lucent dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20031016161355.17421.qmail@sources.redhat.com \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).