My implementation of union non-type template arguments in r11-2016 broke
braced casts of union type, because they are still in syntactic (undigested)
form.
PR c++/104847
gcc/cp/ChangeLog:
* mangle.cc (write_expression): Don't write a union designator when
undigested.
gcc/testsuite/ChangeLog:
* g++.dg/abi/mangle-union1.C: New test.
{
if (i > last_nonzero)
break;
- if (TREE_CODE (etype) == UNION_TYPE)
+ if (!undigested && TREE_CODE (etype) == UNION_TYPE)
{
/* Express the active member as a designator. */
write_string ("di");
--- /dev/null
+// PR c++/104847
+// { dg-do compile { target c++11 } }
+
+struct S { int i; };
+union U { S k; };
+template <class T, class... Ts> T sink(T&&, Ts&&...);
+template <class T>
+decltype(sink(U{1},T())) f(T) { return U{1}; }
+int main() { f(3); }
+// { dg-final { scan-assembler "_Z1fIiEDTcl4sinktl1ULi1EEcvT__EEES1_" } }