public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10773: template method in base class not resolved
@ 2003-05-13 21:19 gtg833i
0 siblings, 0 replies; 2+ messages in thread
From: gtg833i @ 2003-05-13 21:19 UTC (permalink / raw)
To: gcc-gnats
>Number: 10773
>Category: c++
>Synopsis: template method in base class not resolved
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue May 13 21:16:02 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Enrique Robledo Arnuncio
>Release: g++ (GCC) 3.2.3
>Organization:
>Environment:
debian GNU/Linux, unstable (sid) intel i386
>Description:
A template method in a base class can not be resolved on the
concrete class when the concrete class has a method with
the same name.
This may be related to the missing feature mentioned in the
bug reporting instructions, related to two-stages template
lookup, but I have no way to know.
The following code reproduces the problem:
--------------------------------------
class arg {};
struct A
{
template<class T>
int f(T a) { return 10;}
};
struct B : public A
{
// Commenting out next lines "uncovers" the template method in the base
// class, and the program compiles and works.
int f(int a);
};
int main()
{
B b;
arg a;
// Last statement gives this error:
// hidden_template_member.cc: In function `int main()':
// hidden_template_member.cc:27: error: no matching function for call to `B::f(arg&)'
// hidden_template_member.cc:14: note: candidates are: int B::f(int)
return b.f(a);
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c++/10773: template method in base class not resolved
@ 2003-05-13 21:48 bangerth
0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-05-13 21:48 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, gtg833i, nobody
Synopsis: template method in base class not resolved
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Tue May 13 21:48:12 2003
State-Changed-Why:
That's how C++ works. Methods in the base class are hidden.
Use "using" and consult a good book on C++.
Sorry
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10773
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-05-13 21:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-13 21:19 c++/10773: template method in base class not resolved gtg833i
2003-05-13 21:48 bangerth
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).