This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/70
- To: nobody at gcc dot gnu dot org
- Subject: Re: c++/70
- From: Martin Sebor <sebor at roguewave dot com>
- Date: 29 May 2001 18:16:03 -0000
- Cc: gcc-prs at gcc dot gnu dot org,
- Reply-To: Martin Sebor <sebor at roguewave dot com>
The following reply was made to PR c++/70; it has been noted by GNATS.
From: Martin Sebor <sebor@roguewave.com>
To: rodrigc@gcc.gnu.org
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/70
Date: Tue, 29 May 2001 12:10:00 -0600
rodrigc@gcc.gnu.org wrote:
>
> The following reply was made to PR c++/70; it has been noted by GNATS.
>
> From: rodrigc@gcc.gnu.org
> To: gcc-gnats@gcc.gnu.org, jgeremia@princeton.edu, wanderer@rsu.ru,
> martin@loewis.home.cs.tu-berlin.de, nobody@gcc.gnu.org
> Cc:
> Subject: Re: c++/70
> Date: 29 May 2001 02:31:42 -0000
>
> Synopsis: template bug
>
> State-Changed-From-To: analyzed->closed
> State-Changed-By: rodrigc
> State-Changed-When: Mon May 28 19:31:42 2001
> State-Changed-Why:
> Not legal C++.
I don't know of any rule that makes this ill-formed (or not legal),
even though referencing the operator may be ambiguous. operator*()
along with many other binary operators may be defined either as a
member, or as a non-member, or both (13.5.2).
The simplified test case below compiles (with the friend being defined
inline), which confirms that there is a bug (most other compilers also
accept the code in the original test case).
Regards
Martin
template <class T>
struct S;
template <class T>
void operator* (S<T>, S<T>);
template <class T>
struct S
{
friend void operator*<> (S, S); // { } // okay
void operator* (S) { }
};
// template <class T>
// void operator* (S<T>, S<T>) { } // error? not!
S<int> s;