summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/complex3.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/ext/complex3.C')
-rw-r--r--gcc/testsuite/g++.dg/ext/complex3.C28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/ext/complex3.C b/gcc/testsuite/g++.dg/ext/complex3.C
new file mode 100644
index 000000000..062c2d44b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/complex3.C
@@ -0,0 +1,28 @@
+// PR c++/31780
+// { dg-do run }
+// { dg-options "" }
+
+// Test that we can implicitly convert to _Complex, but that it's worse
+// than a scalar arithmetic conversion.
+
+extern "C" void exit (int);
+
+int r = 0;
+
+void f (_Complex int) { ++r; }
+void f (double) { }
+
+void g (_Complex int) { }
+
+int main()
+{
+ f (1);
+ g (1);
+
+ return r;
+}
+
+void bar()
+{
+ r ? 0i : 0;
+}