diff --git a/src/script_opt/ScriptOpt.cc b/src/script_opt/ScriptOpt.cc index fcc2f32fe3..18a5b9d33a 100644 --- a/src/script_opt/ScriptOpt.cc +++ b/src/script_opt/ScriptOpt.cc @@ -370,6 +370,8 @@ static void use_CPP() if ( ! CPP_init_hook ) reporter->FatalError("no C++ functions available to use"); + int num_used = 0; + for ( auto& f : funcs ) { auto hash = f.Profile()->HashVal(); @@ -377,6 +379,8 @@ static void use_CPP() if ( s != compiled_scripts.end() ) { + ++num_used; + auto b = s->second.body; b->SetHash(hash); @@ -407,6 +411,9 @@ static void use_CPP() } } + if ( num_used == 0 ) + reporter->FatalError("no C++ functions found to use"); + // Now that we've loaded all of the compiled scripts // relevant for the AST, activate standalone ones. for ( auto cb : standalone_activations )