Created on 2012-08-25.00:00:00 last changed 58 months ago
Rationale (February, 2021):
The resolution of issue 2174 deleted the paragraph in question and makes clear the treatment of friend function templates.The status of an example like the following is not clear:
template<class> struct x {
template<class T>
friend bool operator==(x<T>, x<T>) { return false; }
};
int main() {
x<int> x1;
x<double> x2;
x1 == x1;
x2 == x2;
}
Such a friend definition is permitted by 13.7.5 [temp.friend] paragraph 2:
A friend function template may be defined within a class or class template...
Paragraph 4 appears to be related, but deals only with friend functions, not friend function templates:
When a function is defined in a friend function declaration in a class template, the function is instantiated when the function is odr-used. The same restrictions on multiple declarations and definitions that apply to non-template function declarations and definitions also apply to these implicit definitions.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2021-02-17 00:00:00 | admin | set | messages: + msg6511 |
| 2021-02-17 00:00:00 | admin | set | status: drafting -> nad |
| 2012-11-03 00:00:00 | admin | set | status: open -> drafting |
| 2012-08-25 00:00:00 | admin | create | |