c++/10773: template method in base class not resolved
gtg833i@mail.gatech.edu
gtg833i@mail.gatech.edu
Tue May 13 21:48:00 GMT 2003
>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:
More information about the Gcc-bugs
mailing list