This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/7863: Member function template argument deduction broken by declaration of name in different scope


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]