aboutsummaryrefslogtreecommitdiff
path: root/final/ABI-Testsuite/test/s3_3_5/s3a.xpp
diff options
context:
space:
mode:
Diffstat (limited to 'final/ABI-Testsuite/test/s3_3_5/s3a.xpp')
-rwxr-xr-xfinal/ABI-Testsuite/test/s3_3_5/s3a.xpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/final/ABI-Testsuite/test/s3_3_5/s3a.xpp b/final/ABI-Testsuite/test/s3_3_5/s3a.xpp
new file mode 100755
index 00000000..2cafd250
--- /dev/null
+++ b/final/ABI-Testsuite/test/s3_3_5/s3a.xpp
@@ -0,0 +1,43 @@
+// This file is distributed under the University of Illinois Open Source License.
+// See LICENSE.TXT for details.
+// RUN: cxx_compiler %s -c -o %t.o
+// RUN: linker %t.o -o %t%exeext
+// RUN: runtool %t%exeext | tee %t.tmp | FileCheck %s
+
+#include <stdio.h>
+#include <stdlib.h>
+
+// CHECK: main()
+// CHECK: fn05()
+// CHECK: fn04()
+// CHECK: fn03()
+// CHECK: ~non_trivial()
+// CHECK: fn02()
+// CHECK: fn01()
+
+void fn01() { printf("%s()\n", __FUNCTION__); }
+void fn02() { printf("%s()\n", __FUNCTION__); }
+void fn03() { printf("%s()\n", __FUNCTION__); }
+void fn04() { printf("%s()\n", __FUNCTION__); }
+void fn05() { printf("%s()\n", __FUNCTION__); }
+
+struct non_trivial {
+ non_trivial() { atexit(fn02); }
+ ~non_trivial() { printf("%s()\n", __FUNCTION__); }
+ int v1;
+};
+
+void foo(void (*fp)()) {
+ static non_trivial v1;
+ atexit(fp);
+}
+
+int main(int argc, char *argv[]) {
+ atexit(fn01);
+ foo(fn03);
+ foo(fn04);
+ atexit(fn05);
+ printf("%s()\n", __FUNCTION__);
+
+ return 0;
+}