diff --git a/src/cpp/cpp_typecheck_code.cpp b/src/cpp/cpp_typecheck_code.cpp index 89a4cedf5be..866a7fbd14a 100644 --- a/src/cpp/cpp_typecheck_code.cpp +++ b/src/cpp/cpp_typecheck_code.cpp @@ -25,12 +25,12 @@ void cpp_typecheckt::typecheck_code(codet &code) if(statement==ID_try_catch) { - code.type()=code_typet(); + code.type() = code_typet({}, empty_typet()); typecheck_try_catch(code); } else if(statement==ID_member_initializer) { - code.type()=code_typet(); + code.type() = code_typet({}, empty_typet()); typecheck_member_initializer(code); } else if(statement==ID_msc_if_exists || diff --git a/src/cpp/cpp_typecheck_constructor.cpp b/src/cpp/cpp_typecheck_constructor.cpp index 4c4edfad22b..a101618da61 100644 --- a/src/cpp/cpp_typecheck_constructor.cpp +++ b/src/cpp/cpp_typecheck_constructor.cpp @@ -435,7 +435,7 @@ void cpp_typecheckt::default_assignop_value( declarator.value().add_source_location()=source_location; declarator.value().id(ID_code); declarator.value().set(ID_statement, ID_block); - declarator.value().type()=code_typet(); + declarator.value().type() = code_typet({}, empty_typet()); exprt &block=declarator.value(); @@ -501,7 +501,7 @@ void cpp_typecheckt::default_assignop_value( ret_code.operands().push_back(exprt(ID_dereference)); ret_code.op0().operands().push_back(exprt("cpp-this")); ret_code.set(ID_statement, ID_return); - ret_code.type()=code_typet(); + ret_code.type() = code_typet({}, empty_typet()); } /// Check a constructor initialization-list. An initializer has to be a data diff --git a/src/cpp/parse.cpp b/src/cpp/parse.cpp index d1ad2256a2c..50b7b256418 100644 --- a/src/cpp/parse.cpp +++ b/src/cpp/parse.cpp @@ -5516,9 +5516,8 @@ bool Parser::rTypeNameOrFunctionType(typet &tname) << "Parser::rTypeNameOrFunctionType 2\n"; #endif - code_typet type; - - if(!rCastOperatorName(type.return_type())) + typet return_type; + if(!rCastOperatorName(return_type)) return false; #ifdef DEBUG @@ -5528,7 +5527,7 @@ bool Parser::rTypeNameOrFunctionType(typet &tname) if(lex.LookAhead(0)!='(') { - tname.swap(type.return_type()); + tname.swap(return_type); if(!optPtrOperator(tname)) return false; @@ -5541,6 +5540,7 @@ bool Parser::rTypeNameOrFunctionType(typet &tname) << "Parser::rTypeNameOrFunctionType 4\n"; #endif + code_typet type({}, return_type); cpp_tokent op; lex.get_token(op); diff --git a/src/goto-instrument/function.cpp b/src/goto-instrument/function.cpp index 4c2b5f598ec..0fd46854ace 100644 --- a/src/goto-instrument/function.cpp +++ b/src/goto-instrument/function.cpp @@ -34,10 +34,7 @@ code_function_callt function_to_call( typet p=pointer_type(char_type()); p.subtype().set(ID_C_constant, true); - code_typet function_type; - function_type.return_type()=empty_typet(); - function_type.parameters().push_back( - code_typet::parametert(p)); + const code_typet function_type({code_typet::parametert(p)}, empty_typet()); symbolt new_symbol; new_symbol.name=id;