public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: reichelt@igpm.rwth-aachen.de To: gcc-gnats@gcc.gnu.org Subject: c++/10371: [3.4 regression] misleading error message for illegal member access Date: Thu, 10 Apr 2003 21:16:00 -0000 [thread overview] Message-ID: <20030410211411.24532.qmail@sources.redhat.com> (raw) >Number: 10371 >Category: c++ >Synopsis: [3.4 regression] misleading error message for illegal member access >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: change-request >Submitter-Id: net >Arrival-Date: Thu Apr 10 21:16:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Volker Reichelt >Release: gcc 3.4-20030402 >Organization: >Environment: i686-pc-linux-gnu >Description: Compiling the following code with "g++ -c" I get an error message which is quite misleading IMHO: ----------------------snip here--------------------- struct A { int i; }; template <int> struct B { int foo() { return A::i; } }; void bar() { B<0>().foo(); } ----------------------snip here--------------------- msg.cc: In member function `int B<<anonymous> >::foo() [with int <anonymous> = 0]': msg.cc:11: instantiated from here msg.cc:8: error: 'struct B<0>' has no member named 'i' We try to access "A::i" which is a member of A and not of B<0> in an illegal fashion. There are (at least) two ways to make the code legal: a) make "i" static or b) derive "B" from "A". Compilers on the release branch at least give a hint w.r.t. b): msg.cc: In member function `int B<<anonymous> >::foo() [with int <anonymous> = 0]': msg.cc:11: instantiated from here msg.cc:8: error: type `A' is not a base type for type `B<0>' Although this is only correct in some cases, I rate the new error message as a regression. For related issues see PR 9443. >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2003-04-10 21:16 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-04-10 21:16 reichelt [this message] 2003-04-16 21:53 bangerth 2003-04-18 13:48 lerdsuwa 2003-04-27 12:36 Kriang Lerdsuwanakij
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=20030410211411.24532.qmail@sources.redhat.com \ --to=reichelt@igpm.rwth-aachen.de \ --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).