Don't allow duplicate definitions of structs and enum struct variants.

Fixes #5792