c++: Support non-type template parms of union type.
authorJason Merrill <jason@redhat.com>
Sat, 4 Jul 2020 09:45:01 +0000 (05:45 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 10 Jul 2020 12:36:50 +0000 (08:36 -0400)
commit6324c52bba490baa17b6001a6d555ff8bef939d6
tree9ecdc93a57d1647235f79b7ae07f94e49f455aa8
parent50f071d999374b6dd13149a31f505d4457c9de6d
c++: Support non-type template parms of union type.

Another thing newly allowed by P1907R1.  The ABI group has discussed
representing unions with designated initializers, and has separately
specified how to represent designators; this patch implements both.

gcc/cp/ChangeLog:

* tree.c (structural_type_p): Allow unions.
* mangle.c (write_expression): Express unions with a designator.

libiberty/ChangeLog:

* cp-demangle.c (cplus_demangle_operators): Add di, dx, dX.
(d_expression_1): Handle di and dX.
(is_designated_init, d_maybe_print_designated_init): New.
(d_print_comp_inner): Use d_maybe_print_designated_init.
* testsuite/demangle-expected: Add designator tests.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/nontype-class-union1.C: New test.
gcc/cp/mangle.c
gcc/cp/tree.c
gcc/testsuite/g++.dg/cpp2a/nontype-class-union1.C [new file with mode: 0644]
libiberty/cp-demangle.c
libiberty/testsuite/demangle-expected