This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/7863: Member function template argument deduction broken by declaration of name in different scope
- From: timb at bluearc dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 9 Sep 2002 13:33:30 -0000
- Subject: c++/7863: Member function template argument deduction broken by declaration of name in different scope
- Reply-to: timb at bluearc dot com
>Number: 7863
>Category: c++
>Synopsis: Member function template argument deduction broken by declaration of name in different scope
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Mon Sep 09 06:36:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: timb@bluearc.com
>Release: 3.2
>Organization:
>Environment:
Debian GNU/Linux x86 unstable
>Description:
Attempting to compile the code below gets the error message "no matching function for call to `A::Foo(int&)'" even though A::Foo<int> would clearly match. Strangely, the problem goes away if the declaration of struct X::Foo is removed, or if the return type of A::Foo<> is changed so it does not involve the template parameter.
>How-To-Repeat:
namespace X
{
struct Foo;
}
struct A
{
template<class T> static T& Foo(T p);
};
void bar()
{
int i;
A::Foo(i);
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: