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++/5369: g++ 3.0.1 fails to honor a template member friend declaration



>Number:         5369
>Category:       c++
>Synopsis:       g++ 3.0.1 fails to honor a template member friend declaration
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 13 13:36:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     sebor@roguewave.com
>Release:        3.0.1
>Organization:
>Environment:

>Description:
I believe this program is well-formed. It fails to compile
with 3.0.1.

Regards
Martin

$ cat t.cpp ;  g++ t.cpp
template <class T>
struct S
{
    int foo () {
        return S<int>::bar ();
    }

private:

    template <class U>
    friend int S<U>::foo ();

    static int bar () { return 0; }
};

int main ()
{
    S<char>().foo ();
}
t.cpp: In member function `int S<T>::foo() [with T = char]':
t.cpp:18:   instantiated from here
t.cpp:13: `static int S<T>::bar() [with T = int]' is private
t.cpp:5: within this context
>How-To-Repeat:

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