public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: zhegulev@sigma.ispras.ru To: gcc-gnats@gcc.gnu.org Subject: c++/3009: Wrong name lookup in template Date: Wed, 30 May 2001 17:06:00 -0000 [thread overview] Message-ID: <20010531000408.6000.qmail@sourceware.cygnus.com> (raw) >Number: 3009 >Category: c++ >Synopsis: Wrong name lookup in template >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed May 30 17:06:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: zhegulev@sigma.ispras.ru >Release: 2.95.3 >Organization: >Environment: >Description: According to 14.6.2.4 of C++ Standard: "If a base class is a dependent type, a member of that class cannot hide a name declared within a template, or a name from the template's eclosing scopes." #include <iostream.h> class B{ public: void foo(){cout << "B::foo"<<endl;} }; void foo() { cout << "::foo()"<<endl;} template <class T> class C :public T { public: void caller(){foo();} }; int main() { C<B> c; c.caller(); return 0; } That example should print ::foo() But it prints B::foo >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="template16.cc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="template16.cc" I2luY2x1ZGUgPGlvc3RyZWFtLmg+CgpjbGFzcyBCewogcHVibGljOgogICB2b2lkIGZvbygpe2Nv dXQgPDwgIkI6OmZvbyI8PGVuZGw7fQp9OwoKdm9pZCBmb28oKQp7IGNvdXQgPDwgIjo6Zm9vKCki PDxlbmRsO30KCnRlbXBsYXRlIDxjbGFzcyBUPgpjbGFzcyBDIDpwdWJsaWMgVAp7CiBwdWJsaWM6 CiAgIHZvaWQgY2FsbGVyKCl7Zm9vKCk7fQp9OwoKCmludCBtYWluKCkKewogIEM8Qj4gYzsKICBj LmNhbGxlcigpOwogIHJldHVybiAwOwp9Cg==
next reply other threads:[~2001-05-30 17:06 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-05-30 17:06 zhegulev [this message] 2003-01-01 20:37 neroden
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=20010531000408.6000.qmail@sourceware.cygnus.com \ --to=zhegulev@sigma.ispras.ru \ --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).