public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: giovannibajo@libero.it To: gcc-gnats@gcc.gnu.org Subject: c++/10621: Calling a non-qualified member function within a sizeof() expression leads to "invalid use of undefined type" Date: Sun, 04 May 2003 14:56:00 -0000 [thread overview] Message-ID: <20030504145210.25387.qmail@sources.redhat.com> (raw) >Number: 10621 >Category: c++ >Synopsis: Calling a non-qualified member function within a sizeof() expression leads to "invalid use of undefined type" >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Sun May 04 14:56:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Giovanni Bajo >Release: 3.3 CVS 20030503, 3.4 CVS 20030503 >Organization: >Environment: i686-pc-cygwin >Description: The following code has always been rejected by GCC: ----------------------------------- struct Foo { static int func(void); enum { value = sizeof(func()) }; }; ----------------------------------- gccbug1.cpp:5: error: invalid use of undefined type `struct Foo' gccbug1.cpp:2: error: forward declaration of `struct Foo' gccbug1.cpp:5: error: enumerator value for `value' not integer constant Notice that it's possible to make the code compile simply by qualifying the function name: sizeof(Foo::func()). >How-To-Repeat: Compile the above snippet >Fix: Qualify the function name >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2003-05-04 14:56 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-05-04 14:56 giovannibajo [this message] 2003-05-04 16:45 bangerth
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=20030504145210.25387.qmail@sources.redhat.com \ --to=giovannibajo@libero.it \ --cc=gcc-gnats@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).