diff options
Diffstat (limited to 'scripts/qapi.py')
-rw-r--r-- | scripts/qapi.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py index 2b43ad2..bd00d01 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -239,6 +239,11 @@ def check_union(expr, expr_info): "type '%s'" % (discriminator, base)) enum_define = find_enum(discriminator_type) + # Do not allow string discriminator + if not enum_define: + raise QAPIExprError(expr_info, + "Discriminator '%s' must be of enumeration " + "type" % discriminator) # Check every branch for (key, value) in members.items(): |