c++/764: g++ 2.95.2 fails to find a friend operator when dereferencing a pointer
sebor@roguewave.com
sebor@roguewave.com
Thu Nov 9 19:36:00 GMT 2000
>Number: 764
>Category: c++
>Synopsis: g++ 2.95.2 fails to find a friend operator when dereferencing a pointer
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 09 19:36:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: sebor@roguewave.com
>Release: 2.95.2, gcc-20001002
>Organization:
>Environment:
>Description:
The compiler fails to find the (non-template) friend
operator defined in a template class when it is applied to
an object obtained by dereferencing a pointer.
When the friend is a template, the problem disappears.
The same error occurs in gcc-20001002.
>How-To-Repeat:
template <class T>
struct S
{
friend bool operator== (const S&, const S&) {
return true;
}
};
int main ()
{
S<int> s;
s == s; // okay
const S<int> *p = &s;
*s == *s; // error
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list