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]

Re: c++/764


nathan@gcc.gnu.org wrote:
> 
> The following reply was made to PR c++/764; it has been noted by GNATS.
> 
> From: nathan@gcc.gnu.org
> To: gcc-gnats@gcc.gnu.org, nathan@gcc.gnu.org, nobody@gcc.gnu.org,
>   sebor@roguewave.com
> Cc:
> Subject: Re: c++/764
> Date: 14 Nov 2000 16:33:31 -0000
> 
>  Synopsis: g++ 2.95.2 fails to find a friend operator when dereferencing a pointer
> 
>  Responsible-Changed-From-To: unassigned->nathan
>  Responsible-Changed-By: nathan
>  Responsible-Changed-When: Tue Nov 14 08:33:31 2000
>  Responsible-Changed-Why:
>      patch in progress
>  State-Changed-From-To: open->analyzed
>  State-Changed-By: nathan
>  State-Changed-When: Tue Nov 14 08:33:31 2000
>  State-Changed-Why:
>      this is user error, but the diagnostic is rather blunt,
>      and confusing.
> 
>      you mean "*p == *p"!
> 
>  http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=764&database=gcc

Sorry, the typo was my mistake (caused by reducing the size of the
code). The original test case also hides the bug, so here's a new
testcase that reproduces it. Uncommenting the definition of `s' in main
eliminates the problem.

Regards
Martin

template <class T>
struct S
{
    friend bool operator== (const S&, const S&) {
        return true;
    }
};

int main ()
{
    // S<int> s;

    const S<int> *p = 0;
    *p == *p; // error
}

$ g++ test.cpp -c
test.cpp: In function `int main()':
test.cpp:33: no match for `const S<int> & == const S<int> &'

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