diff gcc/testsuite/g++.dg/cpp1y/pr79937-4.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/g++.dg/cpp1y/pr79937-4.C	Thu Oct 25 07:37:49 2018 +0900
@@ -0,0 +1,32 @@
+// PR c++/79937
+// { dg-do run { target c++14 } }
+
+struct X {
+  unsigned i;
+  unsigned n = i;
+};
+
+X
+bar (X x)
+{
+  return x;
+}
+
+struct Y
+{
+  static Y bar (Y y) { return y; }
+  unsigned i;
+  unsigned n = bar (Y{2,i}).n;
+};
+
+int
+main ()
+{
+  X x { 1, bar (X{2}).n };
+  if (x.n != 2)
+    __builtin_abort ();
+
+  Y y { 1 };
+  if (y.n != 1)
+    __builtin_abort ();
+}