This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/764: g++ 2.95.2 fails to find a friend operator when dereferencing a pointer
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/764: g++ 2.95.2 fails to find a friend operator when dereferencing a pointer
- From: sebor at roguewave dot com
- Date: 10 Nov 2000 03:34:55 -0000
- Reply-To: sebor at roguewave dot com
>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: