return TT_UnaryOperator;
const FormatToken *NextToken = Tok.getNextNonComment();
- if (!NextToken ||
+ if (!NextToken || NextToken->is(tok::arrow) ||
(NextToken->is(tok::l_brace) && !NextToken->getNextNonComment()))
return TT_Unknown;
verifyGoogleFormat("operator ::A();");
verifyFormat("using A::operator+;");
-
- verifyFormat("string // break\n"
- "operator()() & {}");
- verifyFormat("string // break\n"
- "operator()() && {}");
}
TEST_F(FormatTest, UnderstandsFunctionRefQualification) {
verifyFormat("A = new SomeType *[Length]();", PointerMiddle);
verifyFormat("A = new SomeType *[Length];", PointerMiddle);
verifyFormat("T ** t = new T *;", PointerMiddle);
+
+ // Member function reference qualifiers aren't binary operators.
+ verifyFormat("string // break\n"
+ "operator()() & {}");
+ verifyFormat("string // break\n"
+ "operator()() && {}");
+ verifyGoogleFormat("template <typename T>\n"
+ "auto x() & -> int {}");
}
TEST_F(FormatTest, UnderstandsAttributes) {