Add test case to reproduce bug

Add tokenizer test range based for with decltyle(x) *
This commit is contained in:
Daniel Friedrich 2020-08-16 21:10:55 +02:00
parent 840bd14c8b
commit 160b8f0f17
2 changed files with 5 additions and 0 deletions

View File

@ -6291,6 +6291,10 @@ private:
" for (const auto & e : array)\n"
" foo(e);\n"
" }\n"
" void f3() {\n"
" for (decltype(auto) e : array)\n"
" foo(e);\n"
" }\n"
"};");
ASSERT_EQUALS("[test.cpp:8]: (style, inconclusive) Technically the member function 'Fred::f2' can be const.\n", errout.str());
}

View File

@ -7538,6 +7538,7 @@ private:
ASSERT_EQUALS("forx0=y(8<z;;(", testAst("for (x=0;(int)y<8;z);"));
ASSERT_EQUALS("forab,c:(", testAst("for (auto [a,b]: c);"));
ASSERT_EQUALS("fora*++;;(", testAst("for (++(*a);;);"));
ASSERT_EQUALS("foryz:(", testAst("for (decltype(x) *y : z);"));
// problems with multiple expressions
ASSERT_EQUALS("ax( whilex(", testAst("a(x) while (x)"));