[WIP] Fix ICE related to enum struct variants

This pull request tried to fix #19340, which states two ICE cases related to enum struct variants.

I found this solution by trial and error, so this looks very hacky. Please review it, and direct me to find a better solution.

I'm also to add test cases. Where should I put them?