public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: neil@neilpearce.com To: gcc-gnats@gcc.gnu.org Subject: c++/6262: Incorrect error message reported when applying sizeof() to non-static class member Date: Thu, 11 Apr 2002 11:56:00 -0000 [thread overview] Message-ID: <20020411184826.19726.qmail@sources.redhat.com> (raw) >Number: 6262 >Category: c++ >Synopsis: Incorrect error message reported when applying sizeof() to non-static class member >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Apr 11 11:56:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: neil@neilpearce.com >Release: unknown-1.0 >Organization: >Environment: SunOS 5.8 Generic_108528-01 sun4u sparc SUNW,Ultra-5_10 Reading specs from /usr/local/gcc3.0.4/lib/gcc-lib/sparc-sun-solaris2.8/3.0.4/specs Configured with: ../gcc-3.0.4/configure --exec-prefix=/usr/local/gcc3.0.4 Thread model: posix gcc version 3.0.4 >Description: When using sizeof() on a non-static class member, the error message reported differs depending on the context in which the code appears. GCC 3.0.4 gives an incorrect error message when this is attempted within a constructor >How-To-Repeat: Individually attempt to compile the two sources below, and examine the error messages returned by GCC 3.0.4 ---------- #include <iostream> struct X { char x[1]; }; struct Y { Y() { std::cout << sizeof(X::x); } } Under GCC 3.0.4, compiliation of the above results in z.cc: In constructor `Y::Y()': z.cc:8: cannot convert a pointer of type `Y' to a pointer of type `X' ---------- #include <iostream> struct X { char x[1]; }; int main() { std::cout << sizeof(X::x); } Under GCC 3.0.4, compilation of the above results in z.cc:4: member `X::x' is non-static but referenced as a static member z.cc:8: at this point in file >Fix: >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2002-04-11 18:56 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-04-11 11:56 neil [this message] 2002-08-15 9:36 gdr
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=20020411184826.19726.qmail@sources.redhat.com \ --to=neil@neilpearce.com \ --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).