c++/5369: g++ 3.0.1 fails to honor a template member friend declaration
sebor@roguewave.com
sebor@roguewave.com
Sun Jan 13 13:36:00 GMT 2002
>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:
More information about the Gcc-bugs
mailing list