diff --git a/src/Func.cc b/src/Func.cc index 87783a30a9..85d184295d 100644 --- a/src/Func.cc +++ b/src/Func.cc @@ -434,7 +434,7 @@ ValPtr ScriptFunc::Invoke(zeek::Args* args, Frame* parent) const { // Warn if the function returns something, but we returned from // the function without an explicit return, or without a value. - else if ( GetType()->Yield() && GetType()->Yield()->Tag() != TYPE_VOID && + else if ( GetType()->Yield() && GetType()->Yield()->Tag() != TYPE_VOID && ! GetType()->ExpressionlessReturnOkay() && (flow != FLOW_RETURN /* we fell off the end */ || ! result /* explicit return with no result */) && ! f->HasDelayed() ) reporter->Warning("non-void function returning without a value: %s", Name()); diff --git a/testing/btest/language/when.zeek b/testing/btest/language/when.zeek index d0d07b44fa..d8a447e8fd 100644 --- a/testing/btest/language/when.zeek +++ b/testing/btest/language/when.zeek @@ -26,6 +26,13 @@ event zeek_init() when [h] ( local hname3 = lookup_addr(h) ) {} timeout to + 2sec {} + # The following used to generate a spurious warning, so it's here + # as a regression test. + when ( local res = lookup_addr(127.0.0.1) ) + { + return; + } + print "done"; }