Index: tests/bugs/.expect/10.txt
===================================================================
--- tests/bugs/.expect/10.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/.expect/10.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,1 @@
+bugs/10.cfa:10:53: error: ‘_sizeof_Y1T’ undeclared here (not in a function)
Index: tests/bugs/.expect/194.txt
===================================================================
--- tests/bugs/.expect/194.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/.expect/194.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,40 @@
+bugs/194.cfa:13:1 error: Cannot choose between 2 alternatives for expression
+Applying untyped:
+  Name: foo
+...to:
+ Alternatives are:
+Cost ( 0, 0, 0, 0, 1, 0, 0 ): Application of
+      Variable Expression: foo: forall
+        T: sized data type
+        function
+      ... returning
+        _retval_foo: reference to instance of type T (not function type)
+        ... with attributes:
+          Attribute with name: unused
+
+
+
+  (types:
+    reference to instance of type _79_5_T (not function type)
+  )
+  Environment: -> pointer to signed int
+
+
+Cost ( 0, 0, 0, 0, 1, 0, 0 ): Application of
+      Variable Expression: foo: forall
+        T: sized data type
+        function
+      ... returning
+        _retval_foo: pointer to instance of type T (not function type)
+        ... with attributes:
+          Attribute with name: unused
+
+
+
+  (types:
+    pointer to instance of type _79_6_T (not function type)
+  )
+  Environment: -> signed int (no widening)
+
+
+
Index: tests/bugs/.expect/20.txt
===================================================================
--- tests/bugs/.expect/20.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/.expect/20.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,6 @@
+error: No reasonable alternatives for expression Untyped Init Expression
+  constant expression (0 0: zero_t)  InitAlternative: instance of struct foo with body 1
+bugs/20.cfa:15:1 error: No reasonable alternatives for expression Applying untyped:
+  Name: bar
+...to:
+
Index: tests/bugs/.expect/44.txt
===================================================================
--- tests/bugs/.expect/44.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/.expect/44.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,6 @@
+bugs/44.cfa:9:1 error: No reasonable alternatives for expression Applying untyped:
+  Name: ?=?
+...to:
+  Name: x
+  Name: f
+
Index: tests/bugs/.expect/46.txt
===================================================================
--- tests/bugs/.expect/46.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/.expect/46.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,4 @@
+bugs/46.cfa: In function ‘_X4mainFi___1’:
+bugs/46.cfa:10:100: error: lvalue required as unary ‘&’ operand
+   3 ? x[2] : val;
+                                                                                                    ^
Index: tests/bugs/.expect/5.txt
===================================================================
--- tests/bugs/.expect/5.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/.expect/5.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,8 @@
+bugs/5.cfa: In function ‘_X4mainFi___1’:
+bugs/5.cfa:8:43: error: ‘_unq0_finished_’ undeclared (first use in this function)
+   foo(bar());
+                                           ^              
+bugs/5.cfa:8:43: note: each undeclared identifier is reported only once for each function it appears in
+bugs/5.cfa:8:225: warning: left-hand operand of comma expression has no effect [-Wunused-value]
+   foo(bar());
+                                                                                                                                                                                                                                 ^
Index: tests/bugs/.expect/66.txt
===================================================================
--- tests/bugs/.expect/66.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/.expect/66.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,69 @@
+bugs/66.cfa:11:1 error: Cannot choose between 2 alternatives for expression
+Applying untyped:
+  Name: ?!=?
+...to:
+  Name: next
+  constant expression (0 0: zero_t)
+ Alternatives are:
+Cost ( 0, 2, 17, 0, 1, -2, 0 ): Application of
+      Variable Expression: ?!=?: forall
+        FT: function type
+        function
+      ... with parameters
+        intrinsic pointer to instance of type FT ( function type)
+        intrinsic pointer to instance of type FT ( function type)
+      ... returning
+        _retval__operator_notequal: signed int
+        ... with attributes:
+          Attribute with name: unused
+
+
+    ... to arguments
+      Variable Expression: next: function
+        accepting unspecified arguments
+      ... returning nothing
+
+      Generated Cast of:
+        constant expression (0 0: zero_t)
+      ... to:
+        pointer to function
+          accepting unspecified arguments
+        ... returning nothing
+
+
+  (types:
+    signed int
+  )
+  Environment: -> function
+        accepting unspecified arguments
+      ... returning nothing
+ (no widening)
+
+
+Cost ( 0, 2, 17, 0, 1, -2, 0 ): Application of
+      Variable Expression: ?!=?: forall
+        DT: data type
+        function
+      ... with parameters
+        intrinsic pointer to instance of type DT (not function type)
+        intrinsic pointer to instance of type DT (not function type)
+      ... returning
+        _retval__operator_notequal: signed int
+        ... with attributes:
+          Attribute with name: unused
+
+
+    ... to arguments
+      Variable Expression: next: pointer to signed int
+      Generated Cast of:
+        constant expression (0 0: zero_t)
+      ... to:
+        pointer to signed int
+
+  (types:
+    signed int
+  )
+  Environment: -> signed int (no widening)
+
+
+
Index: tests/bugs/.expect/91.txt
===================================================================
--- tests/bugs/.expect/91.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/.expect/91.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,2 @@
+error: No reasonable alternatives for expression Untyped Init Expression
+  Name: f  InitAlternative: _Bool
Index: tests/bugs/.expect/92.txt
===================================================================
--- tests/bugs/.expect/92.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/.expect/92.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,16 @@
+bugs/92.cfa:6:1 error: No reasonable alternatives for expression Applying untyped:
+  Name: ?{}
+...to:
+  Generated Cast of:
+    Variable Expression: _ret: instance of struct superFred with body 1
+  ... to:
+    reference to instance of struct superFred with body 1
+  Generated Cast of:
+    Variable Expression: _dst: reference to instance of struct superFred with body 1
+  ... to:
+    instance of struct superFred with body 1
+  ... with environment:
+    Types:
+    Non-types:
+
+
Index: tests/bugs/.expect/95.txt
===================================================================
--- tests/bugs/.expect/95.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/.expect/95.txt	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,1 @@
+bugs/95.cfa:8:1 error: List of mutex member is currently unimplemented.
Index: tests/bugs/10.cfa
===================================================================
--- tests/bugs/10.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/10.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,9 @@
+// Trac ticket
+// https://cforall.uwaterloo.ca/trac/ticket/10
+
+forall(otype T)
+struct result {
+      union {
+            T value;
+      };
+};
Index: tests/bugs/104.cfa
===================================================================
--- tests/bugs/104.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/104.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,11 @@
+// Trac ticket
+// https://cforall.uwaterloo.ca/trac/ticket/104
+
+[ float, float ] modf_( float x );
+
+forall(otype T | { [T, T] modf_(T); })
+void modf(T);
+
+int main() {
+    modf(7.0f);
+}
Index: tests/bugs/194.cfa
===================================================================
--- tests/bugs/194.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/194.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,14 @@
+// Trac ticket
+// https://cforall.uwaterloo.ca/trac/ticket/194
+
+forall( dtype T | sized(T) ) T * foo( void ) {
+      printf( "foo1\n" );
+	return (T *)0;
+}
+forall( dtype T | sized(T) ) T & foo( void ) {
+	printf( "foo2\n" );
+	return (T &)*(T *)0;
+}
+int main( void ) {
+      int * i = foo();
+}
Index: tests/bugs/20.cfa
===================================================================
--- tests/bugs/20.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/20.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,16 @@
+// Trac ticket
+// https://cforall.uwaterloo.ca/trac/ticket/20
+
+struct foo {
+	int i;
+};
+
+void ?{}( foo & this, zero_t zero ) {
+	this.i = zero;
+}
+
+extern void bar( foo this = 0 );
+
+int main() {
+	bar();
+}
Index: tests/bugs/44.cfa
===================================================================
--- tests/bugs/44.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/44.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,10 @@
+// Trac ticket
+// https://cforall.uwaterloo.ca/trac/ticket/44
+
+typedef void (*fptr_t)();
+void f(int);
+
+int main() {
+  fptr_t x;
+  x = f;
+}
Index: tests/bugs/46.cfa
===================================================================
--- tests/bugs/46.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/46.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,11 @@
+// Trac ticket
+// https://cforall.uwaterloo.ca/trac/ticket/46
+
+enum E {
+  val
+};
+
+int main() {
+  E x[3];
+  3 ? x[2] : val;
+}
Index: tests/bugs/5.cfa
===================================================================
--- tests/bugs/5.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/5.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,9 @@
+// Trac ticket
+// https://cforall.uwaterloo.ca/trac/ticket/5
+
+[int, int] bar() { return [3, 4]; }
+[void] foo([int] x, [int] y) {}
+
+int main() {
+  foo(bar());
+}
Index: tests/bugs/66.cfa
===================================================================
--- tests/bugs/66.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/66.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,12 @@
+// Trac ticket
+// https://cforall.uwaterloo.ca/trac/ticket/66
+
+void next() {}
+
+int main() {
+	int * next = (void*)0;
+	if( next ) {
+		return 1;
+	}
+	return 0;
+}
Index: tests/bugs/7.cfa
===================================================================
--- tests/bugs/7.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/7.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,41 @@
+// Trac ticket
+// https://cforall.uwaterloo.ca/trac/ticket/7
+
+#include <stdlib.hfa>
+extern "C" {
+#include <stdbool.h>
+}
+
+// (Bug 1 unresolved as of this test.)
+forall(otype T)
+struct stack_node;
+
+forall(otype T)
+struct stack_node {
+    stack_node(T) * next;
+    T item;
+};
+
+forall(otype T)
+struct stack {
+    stack_node(T) * head;
+};
+
+trait stack_errors(otype T) {
+    T emptyStackHandler (stack(T) * this);
+};
+
+forall(otype T | stack_errors(T))
+T pop (stack(T) * this) {
+    return (T){};
+}
+
+int emptyStackHandler (stack(int) * this) {
+    return 0;
+}
+
+int main (int argc, char * argv[]) {
+    stack(int) stackOfInts;
+    pop(&stackOfInts);
+    return 0;
+}
Index: tests/bugs/91.cfa
===================================================================
--- tests/bugs/91.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/91.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,13 @@
+// Trac ticket
+// https://cforall.uwaterloo.ca/trac/ticket/91
+
+#include <stdbool.h>
+
+struct fred {};
+bool ?!=?(const fred & this, zero_t) { return true; }
+
+void foo() {
+	fred f;
+	if(f) {}
+	bool test = f;
+}
Index: tests/bugs/92.cfa
===================================================================
--- tests/bugs/92.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/92.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,17 @@
+// Trac ticket
+// https://cforall.uwaterloo.ca/trac/ticket/92
+
+struct fred{};
+
+void  ?{}(fred & this, int count = 1);
+void  ?{}(fred & this, fred & other) = void;
+void ^?{}(fred & this);
+fred ?=?(fred & this, const fred & other) = void;
+
+struct superFred {
+	fred f;
+};
+
+void foo() {
+	superFred f;
+}
Index: tests/bugs/95.cfa
===================================================================
--- tests/bugs/95.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
+++ tests/bugs/95.cfa	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -0,0 +1,9 @@
+// Trac ticket
+// https://cforall.uwaterloo.ca/trac/ticket/95
+
+#include <monitor.hfa>
+monitor M { condition e; } m;
+void rtn( M & mutex m );
+void bar( M & mutex m ) {
+ 	waitfor( rtn, m ); // not ambiguous, select parameter
+}
Index: tests/pybin/test_run.py
===================================================================
--- tests/pybin/test_run.py	(revision fc9bb791282f9039edf2fe373d71ff9c77f57c60)
+++ tests/pybin/test_run.py	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -69,13 +69,4 @@
 			else :						text = "FAILED with code %d" % retcode
 
-		text += "    C%s - R%s" % (cls.fmtDur(duration[0]), cls.fmtDur(duration[1]))
+		text += "    C%s - R%s" % (fmtDur(duration[0]), fmtDur(duration[1]))
 		return text
-
-	@staticmethod
-	def fmtDur( duration ):
-		if duration :
-			hours, rem = divmod(duration, 3600)
-			minutes, rem = divmod(rem, 60)
-			seconds, millis = divmod(rem, 1)
-			return "%2d:%02d.%03d" % (minutes, seconds, millis * 1000)
-		return " n/a"
Index: tests/pybin/tools.py
===================================================================
--- tests/pybin/tools.py	(revision fc9bb791282f9039edf2fe373d71ff9c77f57c60)
+++ tests/pybin/tools.py	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -387,2 +387,10 @@
 		while True:
 			yield i.next(max(expire - time.time(), 0))
+
+def fmtDur( duration ):
+	if duration :
+		hours, rem = divmod(duration, 3600)
+		minutes, rem = divmod(rem, 60)
+		seconds, millis = divmod(rem, 1)
+		return "%2d:%02d.%03d" % (minutes, seconds, millis * 1000)
+	return " n/a"
Index: tests/test.py
===================================================================
--- tests/test.py	(revision fc9bb791282f9039edf2fe373d71ff9c77f57c60)
+++ tests/test.py	(revision d34575bd6570f3b8d33ebcfeefd4138a053de439)
@@ -361,34 +361,35 @@
 
 		# for each build configurations, run the test
-		for arch, debug, install in itertools.product(settings.all_arch, settings.all_debug, settings.all_install):
-			settings.arch    = arch
-			settings.debug   = debug
-			settings.install = install
-
-			# filter out the tests for a different architecture
-			# tests are the same across debug/install
-			local_tests = settings.arch.filter( tests )
-			options.jobs, forceJobs = job_count( options, local_tests )
-			settings.update_make_cmd(forceJobs, options.jobs)
-
-			# check the build configuration works
-			settings.validate()
-
-			# print configuration
-			print('%s %i tests on %i cores (%s:%s)' % (
-				'Regenerating' if settings.generating else 'Running',
-				len(local_tests),
-				options.jobs,
-				settings.arch.string,
-				settings.debug.string
-			))
-
-			# otherwise run all tests and make sure to return the correct error code
-			failed = run_tests(local_tests, options.jobs)
-			if failed:
-				result = 1
-				if not settings.continue_:
-					break
-
-
+		with Timed() as total_dur:
+			for arch, debug, install in itertools.product(settings.all_arch, settings.all_debug, settings.all_install):
+				settings.arch    = arch
+				settings.debug   = debug
+				settings.install = install
+
+				# filter out the tests for a different architecture
+				# tests are the same across debug/install
+				local_tests = settings.arch.filter( tests )
+				options.jobs, forceJobs = job_count( options, local_tests )
+				settings.update_make_cmd(forceJobs, options.jobs)
+
+				# check the build configuration works
+				settings.validate()
+
+				# print configuration
+				print('%s %i tests on %i cores (%s:%s)' % (
+					'Regenerating' if settings.generating else 'Running',
+					len(local_tests),
+					options.jobs,
+					settings.arch.string,
+					settings.debug.string
+				))
+
+				# otherwise run all tests and make sure to return the correct error code
+				failed = run_tests(local_tests, options.jobs)
+				if failed:
+					result = 1
+					if not settings.continue_:
+						break
+
+		print('Tests took %s' % fmtDur( total_dur.duration ))
 		sys.exit( failed )
