diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 451defe7c..a364e7d35 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -7359,7 +7359,7 @@ void Tokenizer::simplifyReference() } } - tok2->deleteNext(6+(tok->strAt(6)==")" ? 1 : 0)); + tok2->deleteNext(6+(tok2->strAt(6)==")" ? 1 : 0)); } } tok = end; diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 5eb890fba..cf4b44465 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -3352,6 +3352,9 @@ private: tok("void f() { int a; int &b(a); b++; }")); ASSERT_EQUALS("void f ( ) { int a ; a ++ ; }", tok("void f() { int a; int &b = a; b++; }")); + + ASSERT_EQUALS("void test ( ) { c . f ( 7 ) ; }", + tok("void test() { c.f(7); T3 &t3 = c; }")); // #6133 } void simplifyRealloc() {