================
@@ -1071,6 +1071,16 @@ TEST_F(TokenAnnotatorTest,
UnderstandsRequiresClausesAndConcepts) {
"concept C = (!Foo<T>) && Bar;");
ASSERT_EQ(Tokens.size(), 19u) << Tokens;
EXPECT_TOKEN(Tokens[15], tok::ampamp, TT_BinaryOperator);
+
+ Tokens = annotate("void f() & requires(C<decltype(x)>) {}");
+ ASSERT_EQ(Tokens.size(), 18u) << Tokens;
+ EXPECT_TOKEN(Tokens[4], tok::amp, TT_PointerOrReference);
+ EXPECT_TOKEN(Tokens[5], tok::kw_requires, TT_RequiresClause);
+
+ Tokens = annotate("auto f() -> int& requires(C<decltype(x)>) {}");
+ ASSERT_EQ(Tokens.size(), 20u) << Tokens;
+ EXPECT_TOKEN(Tokens[6], tok::amp, TT_PointerOrReference);
+ EXPECT_TOKEN(Tokens[7], tok::kw_requires, TT_RequiresClause);
}
----------------
rymiel wrote:
> If I read the code right my question is why didn't `Foo<decktype(t)>` suffice
> `FoundType && !LastWasColonColon && OpenAngles == 0` when hitting the `x`?
I'm not sure what you mean. If you're talking about `Foo<decltype(t)> x`, it
never gets to the `x` because it reaches the `)` of the decltype first and that
unconditionally leads to being parsed as a clause
https://github.com/llvm/llvm-project/pull/78847
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits