mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
bug fix for empty table constructors with &default attributes (plus a typo)
This commit is contained in:
parent
aa8f11fa17
commit
18fe9d84f6
2 changed files with 9 additions and 1 deletions
|
@ -2407,6 +2407,14 @@ void TableVal::InitDefaultFunc(detail::Frame* f)
|
|||
return;
|
||||
|
||||
const auto& ytype = GetType()->Yield();
|
||||
|
||||
if ( ! ytype )
|
||||
// This happens for empty table() constructors. Don't
|
||||
// instantiate a default value at this point, as we'll
|
||||
// first need to type-check the attribute when the value
|
||||
// is finally used.
|
||||
return;
|
||||
|
||||
const auto& dtype = def_attr->GetExpr()->GetType();
|
||||
|
||||
if ( dtype->Tag() == TYPE_RECORD && ytype->Tag() == TYPE_RECORD && ! same_type(dtype, ytype) &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue