aboutsummaryrefslogtreecommitdiff
path: root/final/ABI-Testsuite/test/s3_3_5/s3a2.xpp
diff options
context:
space:
mode:
Diffstat (limited to 'final/ABI-Testsuite/test/s3_3_5/s3a2.xpp')
-rwxr-xr-xfinal/ABI-Testsuite/test/s3_3_5/s3a2.xpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/final/ABI-Testsuite/test/s3_3_5/s3a2.xpp b/final/ABI-Testsuite/test/s3_3_5/s3a2.xpp
new file mode 100755
index 00000000..9424d90f
--- /dev/null
+++ b/final/ABI-Testsuite/test/s3_3_5/s3a2.xpp
@@ -0,0 +1,35 @@
+// 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: fn03()
+// CHECK: ~non_trivial(), v1 = 2
+// CHECK: fn02()
+// CHECK: ~non_trivial(), v1 = 1
+// CHECK: fn01()
+
+void fn01() { printf("%s()\n", __FUNCTION__); }
+void fn02() { printf("%s()\n", __FUNCTION__); }
+void fn03() { printf("%s()\n", __FUNCTION__); }
+
+struct non_trivial {
+ non_trivial(void (*fp)(), int val) { atexit(fp); v1 = val; }
+ ~non_trivial() { printf("%s(), v1 = %d\n", __FUNCTION__, v1); }
+ int v1;
+};
+
+non_trivial v1(fn01, 1);
+non_trivial v2(fn02, 2);
+
+int main(int argc, char *argv[]) {
+ atexit(fn03);
+ printf("%s()\n", __FUNCTION__);
+
+ return 0;
+}