Skip to content

Commit 160b8f0

Browse files
committed
Add test case to reproduce bug
Add tokenizer test range based for with decltyle(x) *
1 parent 840bd14 commit 160b8f0

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

test/testclass.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6291,6 +6291,10 @@ class TestClass : public TestFixture {
62916291
" for (const auto & e : array)\n"
62926292
" foo(e);\n"
62936293
" }\n"
6294+
" void f3() {\n"
6295+
" for (decltype(auto) e : array)\n"
6296+
" foo(e);\n"
6297+
" }\n"
62946298
"};");
62956299
ASSERT_EQUALS("[test.cpp:8]: (style, inconclusive) Technically the member function 'Fred::f2' can be const.\n", errout.str());
62966300
}

test/testtokenize.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7538,6 +7538,7 @@ class TestTokenizer : public TestFixture {
75387538
ASSERT_EQUALS("forx0=y(8<z;;(", testAst("for (x=0;(int)y<8;z);"));
75397539
ASSERT_EQUALS("forab,c:(", testAst("for (auto [a,b]: c);"));
75407540
ASSERT_EQUALS("fora*++;;(", testAst("for (++(*a);;);"));
7541+
ASSERT_EQUALS("foryz:(", testAst("for (decltype(x) *y : z);"));
75417542

75427543
// problems with multiple expressions
75437544
ASSERT_EQUALS("ax( whilex(", testAst("a(x) while (x)"));

0 commit comments

Comments
 (0)