This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/10773: template method in base class not resolved
- From: gtg833i at mail dot gatech dot edu
- To: gcc-gnats at gcc dot gnu dot org
- Date: 13 May 2003 21:07:33 -0000
- Subject: c++/10773: template method in base class not resolved
- Reply-to: gtg833i at mail dot gatech dot edu
>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: