c++/3115: g++ find a friend operator while it should not
bourguet@cadence.com
bourguet@cadence.com
Mon Jun 11 01:26:00 GMT 2001
>Number: 3115
>Category: c++
>Synopsis: g++ find a friend operator while it should not
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jun 11 01:26:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: bourguet@cadence.com
>Release: Current snapshot at code sourcery
>Organization:
>Environment:
>Description:
The appended code compile while it should not. The
operator+ is in the lexical scope of additive_group_sig
(11.4.5) and so should be found only using argument
dependent name lookup.
template <typename T>
struct additive_group_sig {
friend T operator+(const T& u, const T& v) {
T t(u);
t += v;
return t;
}
};
class Integer {
public:
Integer& operator+=(const Integer&);
private:
additive_group_sig<Integer> x;
};
int main() {
Integer d, e, f;
f = e + d;
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list