Add test for pr97560.
authorAldy Hernandez <aldyh@redhat.com>
Tue, 27 Oct 2020 06:29:42 +0000 (07:29 +0100)
committerAldy Hernandez <aldyh@redhat.com>
Tue, 27 Oct 2020 06:30:52 +0000 (07:30 +0100)
gcc/testsuite/ChangeLog:

PR tree-optimization/97560
* g++.dg/pr97560.C: New test.

gcc/testsuite/g++.dg/pr97560.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/pr97560.C b/gcc/testsuite/g++.dg/pr97560.C
new file mode 100644 (file)
index 0000000..f9e7edf
--- /dev/null
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// { dg-options "-O2 -fno-tree-forwprop -fnon-call-exceptions" }
+
+template <typename>
+struct pv;
+
+template <typename CY>
+struct pv<CY &> {
+  typedef CY g7;
+};
+
+template <typename Q6>
+typename pv<Q6>::g7 hq (Q6 &&lb)
+{
+  return static_cast<typename pv<Q6>::g7 &&> (lb);
+}
+
+struct fk {
+  fk *j6;
+  fk *od;
+};
+
+fk *qi;
+
+struct xz : fk {
+  xz (xz &&)
+  {
+    qi = this;
+
+    if (j6)
+      od = this;
+  }
+};
+
+struct el {
+  struct {
+    xz ls;
+  } eu;
+};
+
+struct be : el {
+};
+
+be l1 = hq (l1);