Open
Description
Bugzilla Link | 23342 |
Version | unspecified |
OS | All |
Extended Description
The out-of-line friend declaration is very likely broken because the declaration is not part of the template. GCC has a -Wnon-template-friend
warning that finds this.
template <typename T>
struct Arg {
friend bool operator==(const Arg& lhs, T rhs) {
return false;
}
friend bool operator!=(const Arg& lhs, T rhs);
};
template <typename T>
bool operator!=(const Arg<T>& lhs, T rhs) {
return true;
}
bool foo() {
Arg<int> arg;
return (arg == 42) || (arg != 42);
}