summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/nrv17.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/opt/nrv17.C')
-rw-r--r--gcc/testsuite/g++.dg/opt/nrv17.C32
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/nrv17.C b/gcc/testsuite/g++.dg/opt/nrv17.C
new file mode 100644
index 000000000..6248bca03
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/nrv17.C
@@ -0,0 +1,32 @@
+// { dg-do run }
+
+#include <cstdlib>
+#include <complex>
+
+void __attribute__((noinline))
+h(std::complex<double> x)
+{
+ if (x.real() != 2.0)
+ std::abort ();
+}
+
+void __attribute__((noinline))
+g(std::complex<double> x)
+{
+ if (x.real() != 0.5)
+ std::abort ();
+}
+
+void __attribute__((noinline))
+f(std::complex<double> x)
+{
+ h (x);
+ x = 1.0 / x;
+ g (x);
+}
+
+int main()
+{
+ f(2.0);
+ return 0;
+}