summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/comdat1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/comdat1.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/comdat1.C23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/comdat1.C b/gcc/testsuite/g++.old-deja/g++.other/comdat1.C
new file mode 100644
index 000000000..a60c86593
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/comdat1.C
@@ -0,0 +1,23 @@
+// { dg-do run }
+// { dg-additional-sources " comdat1-aux.cc" }
+// { dg-options "-O" }
+// Test that statics in inline functions are unified between
+// translation units. Currently we handle this by just suppressing
+// inling and relying on unification of the function itself.
+
+inline int f ()
+{
+ static int i;
+ return ++i;
+}
+
+int g ();
+
+int main ()
+{
+ if (f() != 1
+ || g() != 2
+ || f() != 3)
+ return 1;
+ return 0;
+}