Index: tests/concurrency/waitfor/.expect/autogen_destructor.txt
===================================================================
--- tests/concurrency/waitfor/.expect/autogen_destructor.txt	(revision f1cb1937a0ab02686fc201e2066ee4fc8a157ce6)
+++ tests/concurrency/waitfor/.expect/autogen_destructor.txt	(revision f1cb1937a0ab02686fc201e2066ee4fc8a157ce6)
@@ -0,0 +1,1 @@
+Destructor called
Index: tests/concurrency/waitfor/.expect/static_inline.txt
===================================================================
--- tests/concurrency/waitfor/.expect/static_inline.txt	(revision f1cb1937a0ab02686fc201e2066ee4fc8a157ce6)
+++ tests/concurrency/waitfor/.expect/static_inline.txt	(revision f1cb1937a0ab02686fc201e2066ee4fc8a157ce6)
@@ -0,0 +1,2 @@
+Cleaning
+Done
Index: tests/concurrency/waitfor/autogen_destructor.cfa
===================================================================
--- tests/concurrency/waitfor/autogen_destructor.cfa	(revision f1cb1937a0ab02686fc201e2066ee4fc8a157ce6)
+++ tests/concurrency/waitfor/autogen_destructor.cfa	(revision f1cb1937a0ab02686fc201e2066ee4fc8a157ce6)
@@ -0,0 +1,5 @@
+#include "nodestructor.hfa"
+
+int main(int, char*[]) {
+	MyThread t;
+}
Index: tests/concurrency/waitfor/nodestructor.cfa
===================================================================
--- tests/concurrency/waitfor/nodestructor.cfa	(revision f1cb1937a0ab02686fc201e2066ee4fc8a157ce6)
+++ tests/concurrency/waitfor/nodestructor.cfa	(revision f1cb1937a0ab02686fc201e2066ee4fc8a157ce6)
@@ -0,0 +1,8 @@
+#include "nodestructor.hfa"
+
+#include <fstream.hfa>
+
+void main(MyThread &t) {
+	waitfor(^?{} : t);
+	sout | "Destructor called";
+}
Index: tests/concurrency/waitfor/nodestructor.hfa
===================================================================
--- tests/concurrency/waitfor/nodestructor.hfa	(revision f1cb1937a0ab02686fc201e2066ee4fc8a157ce6)
+++ tests/concurrency/waitfor/nodestructor.hfa	(revision f1cb1937a0ab02686fc201e2066ee4fc8a157ce6)
@@ -0,0 +1,5 @@
+#include <thread.hfa>
+
+thread MyThread {};
+
+void main(MyThread &t);
Index: tests/concurrency/waitfor/static_inline.cfa
===================================================================
--- tests/concurrency/waitfor/static_inline.cfa	(revision f1cb1937a0ab02686fc201e2066ee4fc8a157ce6)
+++ tests/concurrency/waitfor/static_inline.cfa	(revision f1cb1937a0ab02686fc201e2066ee4fc8a157ce6)
@@ -0,0 +1,25 @@
+#include <fstream.hfa>
+#include <thread.hfa>
+
+thread Cleaner {};
+
+static inline void ^?{} ( Cleaner &mutex this ) {}
+
+static inline void cleanup( Cleaner &mutex this ) {}
+
+void main( Cleaner & this ) {
+	waitfor( cleanup : this ) {
+		sout | "Cleaning";
+	}
+
+	waitfor( ^?{} : this ) {
+		sout | "Done";
+	}
+}
+
+int main() {
+    // Creates a thread that will call the destructor
+    // when the thread exits
+	Cleaner c;
+	cleanup( c );
+}
