[cpu] Use dynamic cast for downcasting pointers

This commit is contained in:
Sandy Carter 2019-07-13 14:10:22 -04:00
parent 0cf34743cc
commit 74d30f8348
2 changed files with 2 additions and 2 deletions

View File

@ -106,7 +106,7 @@ Symbol::Status Module::DeclareFunction(uint32_t address,
Symbol* symbol;
Symbol::Status status =
DeclareSymbol(Symbol::Type::kFunction, address, &symbol);
*out_function = static_cast<Function*>(symbol);
*out_function = dynamic_cast<Function*>(symbol);
return status;
}

View File

@ -197,7 +197,7 @@ Function* Processor::DefineBuiltin(const std::string& name,
function->set_end_address(address + 4);
function->set_name(name);
auto builtin_function = static_cast<BuiltinFunction*>(function);
auto builtin_function = dynamic_cast<BuiltinFunction*>(function);
builtin_function->SetupBuiltin(handler, arg0, arg1);
function->set_status(Symbol::Status::kDeclared);