diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 1d8269b2c..bb6ab9bd0 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -1891,12 +1891,8 @@ bool TemplateSimplifier::simplifyTemplateInstantiations( } // process uninstantiated templates - const std::list::iterator it = std::find_if(mTemplateInstantiations.begin(), - mTemplateInstantiations.end(), - FindName(templateDeclaration.name)); - // TODO: remove the specialized check and handle all uninstantiated templates someday. - if (it == mTemplateInstantiations.end() && specialized) { + if (!instantiated && specialized) { simplifyCalculations(templateDeclaration.token); Token * tok2 = const_cast(templateDeclaration.nameToken); diff --git a/test/testsimplifytemplate.cpp b/test/testsimplifytemplate.cpp index 08a2dbd26..0fa3d3b96 100644 --- a/test/testsimplifytemplate.cpp +++ b/test/testsimplifytemplate.cpp @@ -508,9 +508,9 @@ private: "}\n"; // The expected result.. - const char expected[] = "void a<2> ( ) ; " + const char expected[] = "void a<0> ( ) ; " + "void a<2> ( ) ; " "void a<1> ( ) ; " - "void a<0> ( ) ; " "void a<0> ( ) { } " "int main ( ) " "{ a<2> ( ) ; return 0 ; } " @@ -1721,26 +1721,16 @@ private: "template <> void Fred::foo() { }\n" "template <> void Fred::foo() { }"; const char exp[] = "struct Fred { " - "static void foo ( ) ; " - "static void foo ( ) ; " - "static void foo ( ) ; " "static void foo ( ) ; " - "} ; " - "void Fred :: foo ( ) { } " - "void Fred :: foo ( ) { } " - "void Fred :: foo ( ) { } " - "void Fred :: foo ( ) { }"; - const char act[] = "struct Fred { " + "static void foo ( ) ; " "static void foo ( ) ; " "static void foo ( ) ; " "} ; " - "void Fred :: foo ( ) ; " "void Fred :: foo ( ) { } " - "void Fred :: foo ( ) ; " "void Fred :: foo ( ) { } " "void Fred :: foo ( ) { } " "void Fred :: foo ( ) { }"; - TODO_ASSERT_EQUALS(exp, act, tok(code)); + ASSERT_EQUALS(exp, tok(code)); } void template90() { // crash @@ -1763,11 +1753,11 @@ private: "template<> int foo(int a) { return a; }\n" "template float foo(float);\n" "template double foo(double);"; - const char exp[] = "float foo ( float t ) ; " - "double foo ( double t ) ; " + const char exp[] = "int foo ( int a ) ; " "char foo ( char a ) ; " + "float foo ( float t ) ; " + "double foo ( double t ) ; " "char foo ( char a ) { return a ; } " - "int foo ( int a ) ; " "int foo ( int a ) { return a ; } " "float foo ( float t ) { return t ; } " "double foo ( double t ) { return t ; }"; @@ -1782,11 +1772,11 @@ private: "template float Fred::foo(float);\n" "template double Fred::foo(double);"; const char exp[] = "struct Fred { " + "int foo ( int a ) ; " + "char foo ( char a ) ; " "float foo ( float t ) ; " "double foo ( double t ) ; " - "char foo ( char a ) ; " "char foo ( char a ) { return a ; } " - "int foo ( int a ) ; " "int foo ( int a ) { return a ; } " "} ; " "float Fred :: foo ( float t ) { return t ; } " @@ -1805,11 +1795,11 @@ private: "template double NS1::NS2::foo(double);"; const char exp[] = "namespace NS1 { " "namespace NS2 { " + "int foo ( int a ) ; " + "char foo ( char a ) ; " "float foo ( float t ) ; " "double foo ( double t ) ; " - "char foo ( char a ) ; " "char foo ( char a ) { return a ; } " - "int foo ( int a ) ; " "int foo ( int a ) { return a ; } " "} " "} "