diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index ae501af78..41a6af326 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -341,6 +341,7 @@ private: TEST_CASE(simplifyOperatorName27); TEST_CASE(simplifyOperatorName28); TEST_CASE(simplifyOperatorName29); // spaceship operator + TEST_CASE(simplifyOperatorName31); // #6342 TEST_CASE(simplifyOverloadedOperators1); TEST_CASE(simplifyOverloadedOperators2); // (*this)(123) @@ -4834,6 +4835,17 @@ private: ASSERT_EQUALS(code, tokenizeAndStringify(code)); } + void simplifyOperatorName31() { // #6342 + const char code[] = "template \n" + "struct B {\n" + " typedef T A[3];\n" + " operator A& () { return x_; }\n" + " A x_;\n" + "};"; + ASSERT_EQUALS("template < typename T >\nstruct B {\n\noperatorT ( & ( ) ) [ 3 ] { return x_ ; }\nT x_ [ 3 ] ;\n} ;", tokenizeAndStringify(code)); + ASSERT_EQUALS("", errout.str()); + } + void simplifyOperatorName10() { // #8746 const char code1[] = "using a::operator=;"; ASSERT_EQUALS("using a :: operator= ;", tokenizeAndStringify(code1));