Skip to content

Commit 22eeeed

Browse files
Add test for #6342 (#3569)
* Add test for #6342 * Format
1 parent 80578c3 commit 22eeeed

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/testtokenize.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ class TestTokenizer : public TestFixture {
341341
TEST_CASE(simplifyOperatorName27);
342342
TEST_CASE(simplifyOperatorName28);
343343
TEST_CASE(simplifyOperatorName29); // spaceship operator
344+
TEST_CASE(simplifyOperatorName31); // #6342
344345

345346
TEST_CASE(simplifyOverloadedOperators1);
346347
TEST_CASE(simplifyOverloadedOperators2); // (*this)(123)
@@ -4834,6 +4835,17 @@ class TestTokenizer : public TestFixture {
48344835
ASSERT_EQUALS(code, tokenizeAndStringify(code));
48354836
}
48364837

4838+
void simplifyOperatorName31() { // #6342
4839+
const char code[] = "template <typename T>\n"
4840+
"struct B {\n"
4841+
" typedef T A[3];\n"
4842+
" operator A& () { return x_; }\n"
4843+
" A x_;\n"
4844+
"};";
4845+
ASSERT_EQUALS("template < typename T >\nstruct B {\n\noperatorT ( & ( ) ) [ 3 ] { return x_ ; }\nT x_ [ 3 ] ;\n} ;", tokenizeAndStringify(code));
4846+
ASSERT_EQUALS("", errout.str());
4847+
}
4848+
48374849
void simplifyOperatorName10() { // #8746
48384850
const char code1[] = "using a::operator=;";
48394851
ASSERT_EQUALS("using a :: operator= ;", tokenizeAndStringify(code1));

0 commit comments

Comments
 (0)