================ @@ -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); } ---------------- owenca wrote:
> The fix I would originally do was just look behind again and see if the ) > belongs to a decltype, I just also tried removing the case entirely, and was > surprised it works. If you prefer, I can follow my original plan and add an > extra check for decltype In general, I prefer to not include code that can't be reached by test cases as the code is likely superfluous. Because @HazardyKnusperkeks is ok with its removal, wouldn't be better to just do that? https://github.com/llvm/llvm-project/pull/78847 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits