Eric Blake <ebl...@redhat.com> writes:

> The documentation claims that alternates are useful for
> allowing two types, although nothing enforces this.  Meanwhile,

"two or more"

Can touch up on commit.

> it is silent on whether empty unions are allowed.  In practice,
> the generated code will compile, in part because we have a
> 'void *data' branch; but attempting to visit such a type will
> cause an abort().  While there's no technical reason that a
> degenerate union could not be made to work, it's harder to
> justify the time spent in chasing known (the current abort()
> during visit) and unknown corner cases, than it would be to
> just outlaw them.  A future patch will probably take the
> approach of forbidding them; in the meantime, we can at least
> add testsuite coverage to make it obvious where things stand.
>
> In addition to adding tests to expose the problems, we also
> need to adjust existing tests that are meant to test something
> else, but which could fail for the wrong reason if we reject
> degenerate alternates/unions.
>
> Note that empty structs are explicitly supported (for example,
> right now they are the only way to specify that one branch of a
> flat union adds no additional members), and empty enums are
> covered by the testsuite as working (even if they do not seem
> to have much use).
>
> Signed-off-by: Eric Blake <ebl...@redhat.com>
>
> ---
> v6: commit message improved, rebase to earlier added tests

Patch is fine.

Reply via email to