Index: tests/bugs/.expect/10.txt
===================================================================
--- tests/bugs/.expect/10.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/.expect/10.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -0,0 +1,1 @@
+bugs/10.cfa:10:53: error: ‘_sizeof_Y1T’ undeclared here (not in a function)
Index: tests/bugs/.expect/104.txt
===================================================================
--- tests/bugs/.expect/104.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/.expect/104.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -0,0 +1,48 @@
+bugs/104.cfa:7:163: error: expected ‘;’, ‘,’ or ‘)’ before ‘=’ token
+ void modf(T);
+                                                                                                                                                                   ^
+bugs/104.cfa:7:202: error: expected ‘;’, ‘,’ or ‘)’ before ‘__attribute__’
+ void modf(T);
+                                                                                                                                                                                                          ^            
+bugs/104.cfa: In function ‘_adapterFS8_tuple2__ff__f_P_P’:
+bugs/104.cfa:9:41: error: expected ‘)’ before ‘,’ token
+ int main() {
+                                         ^
+                                         )
+bugs/104.cfa:9:4: error: expected ‘)’ before ‘*’ token
+ int main() {
+    ^ ~
+    )
+bugs/104.cfa:9:24: note: to match this ‘(’
+ int main() {
+                        ^
+bugs/104.cfa:9:8: error: expected ‘)’ before ‘_X13_retval_modf_T2Y1TY1T_1’
+ int main() {
+        ^~~~~                      
+        )
+bugs/104.cfa:9:23: note: to match this ‘(’
+ int main() {
+                       ^
+bugs/104.cfa:9:56: error: expected ‘)’ before ‘,’ token
+ int main() {
+                                                        ^
+                                                        )
+bugs/104.cfa:6:4: error: expected ‘)’ before ‘(’ token
+ forall(otype T | { [T, T] modf_(T); })
+    ^ ~
+    )
+bugs/104.cfa:9:39: note: to match this ‘(’
+ int main() {
+                                       ^
+bugs/104.cfa:6:31: error: expected ‘)’ before ‘_adaptee’
+ forall(otype T | { [T, T] modf_(T); })
+                               ^~~~~~~~
+                               )
+bugs/104.cfa:9:38: note: to match this ‘(’
+ int main() {
+                                      ^
+bugs/104.cfa: In function ‘_X4mainFi___1’:
+bugs/104.cfa:10:16: warning: implicit declaration of function ‘_X4modfQ1_0_0_5__X16_operator_assignFBD0_BD0BD0__X12_constructorFv_BD0__X12_constructorFv_BD0BD0__X11_destructorFv_BD0__X5modf_FT2BD0BD0_BD0__Fv_BD0__1’; did you mean ‘_X21_operator_exponentialQ1_0_0_6__X16_operator_assignFBD0_BD0BD0__X12_constructorFv_BD0__X12_constructorFv_BD0BD0__X11_destructorFv_BD0__X12_constructorFv_BD0O__X18_operator_multiplyFBD0_BD0BD0__FBD0_BD0m__1’? [-Wimplicit-function-declaration]
+     modf(7.0f);
+                ^                                                                                                                                                      
+                _X21_operator_exponentialQ1_0_0_6__X16_operator_assignFBD0_BD0BD0__X12_constructorFv_BD0__X12_constructorFv_BD0BD0__X11_destructorFv_BD0__X12_constructorFv_BD0O__X18_operator_multiplyFBD0_BD0BD0__FBD0_BD0m__1
Index: tests/bugs/.expect/194.txt
===================================================================
--- tests/bugs/.expect/194.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/.expect/194.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/.expect/20.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/.expect/44.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/.expect/46.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/.expect/5.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/.expect/66.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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/7.txt
===================================================================
--- tests/bugs/.expect/7.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/.expect/7.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -0,0 +1,11 @@
+bugs/7.cfa: In function ‘_adapterFi_PS5stack_i__P_M’:
+bugs/7.cfa:25:17: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
+     T emptyStackHandler (stack(T) * this);
+                 ^
+bugs/7.cfa:25:42: error: expected ‘)’ before ‘_adaptee’
+     T emptyStackHandler (stack(T) * this);
+                                          ^       
+                                          )
+bugs/7.cfa:37:75: note: to match this ‘(’
+ int main (int argc, char * argv[]) {
+                                                                           ^
Index: tests/bugs/.expect/91.txt
===================================================================
--- tests/bugs/.expect/91.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/.expect/91.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/.expect/92.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/.expect/95.txt	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/10.cfa	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/104.cfa	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/194.cfa	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/20.cfa	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/44.cfa	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/46.cfa	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/5.cfa	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/66.cfa	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/7.cfa	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/91.cfa	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/92.cfa	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
+++ tests/bugs/95.cfa	(revision 4d23dd2e7dcddf0d36dcf4f5dce569634bce9d2e)
@@ -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
+}
