<http://wg21.link/cwg1940> clarified that static_assert in anonymous
unions are permitted, but nowhere in the testsuite do we test that.

Tested on x86_64-linux, ok for trunk?

2019-05-21  Marek Polacek  <pola...@redhat.com>

        DR 1940 - static_assert in anonymous unions.
        * g++.dg/DRs/dr1940.C: New test.

diff --git gcc/testsuite/g++.dg/DRs/dr1940.C gcc/testsuite/g++.dg/DRs/dr1940.C
new file mode 100644
index 00000000000..dee4ae998a6
--- /dev/null
+++ gcc/testsuite/g++.dg/DRs/dr1940.C
@@ -0,0 +1,13 @@
+// DR 1940 - static_assert in anonymous unions
+// { dg-do compile { target c++11 } }
+
+namespace N {
+  static union { int i; static_assert(1, ""); };
+}
+
+void
+g ()
+{
+  union { int j; static_assert(1, ""); };
+  N::i = 42;
+}

Reply via email to