File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -21,14 +21,20 @@ class SpaceShipDefaultCompare {
2121};
2222
2323class EqDefaultCompareOutOfClass {
24- int used; // no warning
24+ int used; // no warning, the compiler generated AST for the comparison operator
25+ // references the fields of the class, and this should be considered
26+ // a use.
27+ // This test case is needed because clang does not emit the body
28+ // of the defaulted operator when it is defined in-class until it
29+ // finds a call to it. `-Wunused-private-field` is suppressed in
30+ // a different way in that case.
2531 bool operator ==(const EqDefaultCompareOutOfClass &) const ;
2632};
2733
2834bool EqDefaultCompareOutOfClass::operator ==(const EqDefaultCompareOutOfClass &) const = default ;
2935
3036class FriendEqDefaultCompareOutOfClass {
31- int used; // no warning
37+ int used; // no warning, same reasoning just tested via a friend declaration.
3238 friend bool operator ==(const FriendEqDefaultCompareOutOfClass &, const FriendEqDefaultCompareOutOfClass &);
3339};
3440
You can’t perform that action at this time.
0 commit comments