Issue 180517.2: Tagless variant parts

Author: Tom Tromey
Champion: Markus Metzger
Date submitted: 2018-05-17
Date revised:
Date closed: 2022-01-10
Type: Enhancement
Status: Rejected
DWARF Version: 6
Section 5.7.10, pg 123

I'm working on improving the DWARF output of the Rust compiler.

In Rust, an enum is a discriminated union.  The compiler supplies 
the discriminant.  It's possible in Rust to have a unvariant enum, 
in which case the compiler omits the discriminant field entirely.

In the Rust compiler (and in LLVM and in gdb) we've chosen to 
represent this as a DW_TAG_variant_part that has a single child 
(the enum payload), but which does not have a DW_AT_discr member.

I suggest adding text to 5.7.10 allowing this use, for example:

If the variant part does not have a discriminant, then the variant 
part should have a single DW_TAG_variant child.

2022-01-10: Rejected
  Proposed change conflicts with usage in Pascal and Ada. 
  Standard allows proposed use case.