diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 19a58e0d8..6fc4eaa84 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -3466,7 +3466,6 @@ void TemplateSimplifier::fixForwardDeclaredDefaultArgumentValues() } if (end) TokenList::copyTokens(const_cast(params2[k]), params1[k]->next(), end->previous()); - break; } } diff --git a/test/testsimplifytemplate.cpp b/test/testsimplifytemplate.cpp index 6597edf1d..40e2903f9 100644 --- a/test/testsimplifytemplate.cpp +++ b/test/testsimplifytemplate.cpp @@ -4729,6 +4729,26 @@ private: ASSERT_EQUALS(exp, tok(code)); } + { // #10432 + const char code[] = "template\n" + "class Foo;\n" + "template\n" + "class Foo\n" + "{\n" + "public:\n" + " T operator[](int Index) const;\n" + "};\n" + "template\n" + "T Foo::operator[](int Index) const\n" + "{\n" + " return T{};\n" + "}\n" + "Foo<> f;"; + const char exp[] = "class Foo<128,wchar_t> ; Foo<128,wchar_t> f ; " + "class Foo<128,wchar_t> { public: wchar_t operator[] ( int Index ) const ; } ; " + "wchar_t Foo<128,wchar_t> :: operator[] ( int Index ) const { return wchar_t { } ; }"; + ASSERT_EQUALS(exp, tok(code)); + } } void template_default_type() {