diff --git a/regression/cpp/Decltype3/test.desc b/regression/cpp/Decltype3/test.desc index 4f2ea3daafc..08c77bc8bf5 100644 --- a/regression/cpp/Decltype3/test.desc +++ b/regression/cpp/Decltype3/test.desc @@ -1,4 +1,4 @@ -KNOWNBUG +CORE main.cpp -std=c++11 ^EXIT=0$ diff --git a/regression/cpp/Template_Instantiation4/test.desc b/regression/cpp/Template_Instantiation4/test.desc index 5893356edf6..a003b07b93c 100644 --- a/regression/cpp/Template_Instantiation4/test.desc +++ b/regression/cpp/Template_Instantiation4/test.desc @@ -1,4 +1,4 @@ -KNOWNBUG +CORE main.cpp ^EXIT=0$ diff --git a/src/cpp/cpp_typecheck.cpp b/src/cpp/cpp_typecheck.cpp index 8b3c64cebc3..e9fc71e35c6 100644 --- a/src/cpp/cpp_typecheck.cpp +++ b/src/cpp/cpp_typecheck.cpp @@ -277,7 +277,12 @@ void cpp_typecheckt::clean_up() const symbolt &symbol=cur_it->second; // erase templates - if(symbol.type.get_bool(ID_is_template)) + if(symbol.type.get_bool(ID_is_template) || + // Remove all symbols that have not been converted. + // In particular this includes symbols created for functions + // during template instantiation that are never called, + // and hence, their bodies have not been converted. + contains_cpp_name(symbol.value)) { symbol_table.erase(cur_it); continue; @@ -327,3 +332,13 @@ bool cpp_typecheckt::builtin_factory(const irep_idt &identifier) { return ::builtin_factory(identifier, symbol_table, get_message_handler()); } + +bool cpp_typecheckt::contains_cpp_name(const exprt &expr) +{ + if(expr.id() == ID_cpp_name || expr.id() == ID_cpp_declaration) + return true; + forall_operands(it, expr) + if(contains_cpp_name(*it)) + return true; + return false; +} diff --git a/src/cpp/cpp_typecheck.h b/src/cpp/cpp_typecheck.h index e7a74aed1ff..bfb6a76b17b 100644 --- a/src/cpp/cpp_typecheck.h +++ b/src/cpp/cpp_typecheck.h @@ -590,6 +590,8 @@ class cpp_typecheckt:public c_typecheck_baset exprt &new_expr, bool check_constantness=true); + bool contains_cpp_name(const exprt &expr); + private: typedef std::list dynamic_initializationst; dynamic_initializationst dynamic_initializations;