summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/cleanup-2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/ext/cleanup-2.C')
-rw-r--r--gcc/testsuite/g++.dg/ext/cleanup-2.C22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/ext/cleanup-2.C b/gcc/testsuite/g++.dg/ext/cleanup-2.C
new file mode 100644
index 000000000..d9033b454
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/cleanup-2.C
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+/* { dg-options "" } */
+/* Verify that cleanup works in the most basic of ways. */
+
+extern "C" void exit(int);
+extern "C" void abort(void);
+
+static void handler(void *p __attribute__((unused)))
+{
+ exit (0);
+}
+
+static void doit(void)
+{
+ int x __attribute__((cleanup (handler)));
+}
+
+int main()
+{
+ doit ();
+ abort ();
+}