public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/3009: Wrong name lookup in template
@ 2003-01-01 20:37 neroden
  0 siblings, 0 replies; 2+ messages in thread
From: neroden @ 2003-01-01 20:37 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, zhegulev

Synopsis: Wrong name lookup in template

State-Changed-From-To: analyzed->closed
State-Changed-By: neroden
State-Changed-When: Wed Jan  1 12:37:05 2003
State-Changed-Why:
    Fixed by new parser.  Testcase is in g++.dg/lookup/template1.C.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3009


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/3009: Wrong name lookup in template
@ 2001-05-30 17:06 zhegulev
  0 siblings, 0 replies; 2+ messages in thread
From: zhegulev @ 2001-05-30 17:06 UTC (permalink / raw)
  To: gcc-gnats

>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==


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-01 20:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-01 20:37 c++/3009: Wrong name lookup in template neroden
  -- strict thread matches above, loose matches on Subject: below --
2001-05-30 17:06 zhegulev

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).