Index: libcfa/src/bits/locks.hfa
===================================================================
--- libcfa/src/bits/locks.hfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ libcfa/src/bits/locks.hfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -130,5 +130,5 @@
 		pthread_mutex_init(&lock, &mattr);
 
-		pthread_cond_init (&cond, 0p);
+		pthread_cond_init (&cond, (const pthread_condattr_t *)0p);  // workaround trac#208: cast should not be required
 		val = 0;
 	}
Index: libcfa/src/concurrency/kernel.cfa
===================================================================
--- libcfa/src/concurrency/kernel.cfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ libcfa/src/concurrency/kernel.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -519,5 +519,5 @@
 
 void kernel_abort_msg( void * kernel_data, char * abort_text, int abort_text_size ) {
-	$thread * thrd = kernel_data;
+	$thread * thrd = ( $thread * ) kernel_data;
 
 	if(thrd) {
Index: libcfa/src/concurrency/preemption.cfa
===================================================================
--- libcfa/src/concurrency/preemption.cfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ libcfa/src/concurrency/preemption.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -482,5 +482,5 @@
 	sigset_t oldset;
 	int ret;
-	ret = pthread_sigmask(0, 0p, &oldset);
+	ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset);  // workaround trac#208: cast should be unnecessary
 	if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); }
 
Index: libcfa/src/containers/list.hfa
===================================================================
--- libcfa/src/containers/list.hfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ libcfa/src/containers/list.hfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -22,5 +22,5 @@
 \
 static inline NODE& $tempcv_e2n(ELEM &node) { \
-	return node; \
+	return ( NODE & ) node; \
 } \
 \
@@ -187,5 +187,5 @@
 		$next_link(singleton_to_insert) = $next_link(list_pos);
 		if ($next_link(list_pos).is_terminator) {
-			dlist(Tnode, Telem) *list = $next_link(list_pos).terminator;
+			dlist(Tnode, Telem) *list = ( dlist(Tnode, Telem) * ) $next_link(list_pos).terminator;
 			$dlinks(Telem) *list_links = & list->$links;
 			$mgd_link(Telem) *list_last = & list_links->prev;
@@ -210,5 +210,5 @@
 		$prev_link(singleton_to_insert) = $prev_link(list_pos);
 		if ($prev_link(list_pos).is_terminator) {
-			dlist(Tnode, Telem) *list = $prev_link(list_pos).terminator;
+			dlist(Tnode, Telem) *list = ( dlist(Tnode, Telem) * ) $prev_link(list_pos).terminator;
 			$dlinks(Telem) *list_links = & list->$links;
 			$mgd_link(Telem) *list_first = & list_links->next;
@@ -275,5 +275,5 @@
 
 		if ( $prev_link(list_pos).is_terminator ) {
-			dlist(Tnode, Telem) * tgt_before = $prev_link(list_pos).terminator;
+			dlist(Tnode, Telem) * tgt_before = ( dlist(Tnode, Telem) * ) $prev_link(list_pos).terminator;
 			$dlinks(Telem) * links_before = & tgt_before->$links;
 			&incoming_from_prev = & links_before->next;
@@ -285,5 +285,5 @@
 
 		if ( $next_link(list_pos).is_terminator ) {
-			dlist(Tnode, Telem) * tgt_after = $next_link(list_pos).terminator;
+			dlist(Tnode, Telem) * tgt_after = ( dlist(Tnode, Telem) * ) $next_link(list_pos).terminator;
 			$dlinks(Telem) * links_after = & tgt_after->$links;
 			&incoming_from_next = & links_after->prev;
Index: libcfa/src/heap.cfa
===================================================================
--- libcfa/src/heap.cfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ libcfa/src/heap.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -10,6 +10,6 @@
 // Created On       : Tue Dec 19 21:58:35 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Jul 20 23:00:32 2020
-// Update Count     : 808
+// Last Modified On : Mon Jul 27 23:16:18 2020
+// Update Count     : 815
 //
 
@@ -805,4 +805,5 @@
 	// address of header from malloc
 	HeapManager.Storage.Header * realHeader = headerAddr( addr );
+	realHeader->kind.real.size = size;					// correct size to eliminate above alignment offset
 	// address of fake header * before* the alignment location
 	HeapManager.Storage.Header * fakeHeader = headerAddr( user );
Index: libcfa/src/iostream.hfa
===================================================================
--- libcfa/src/iostream.hfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ libcfa/src/iostream.hfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -363,5 +363,5 @@
 	_Istream_Cstr excl( const char scanset[], char * s ) { return (_Istream_Cstr){ s, scanset, -1, { .flags.inex : true } }; }
 	_Istream_Cstr & excl( const char scanset[], _Istream_Cstr & fmt ) { fmt.scanset = scanset; fmt.flags.inex = true; return fmt; }
-	_Istream_Cstr ignore( const char s[] ) { return (_Istream_Cstr)@{ s, 0p, -1, { .flags.ignore : true } }; }
+	_Istream_Cstr ignore( char s[] ) { return (_Istream_Cstr)@{ s, 0p, -1, { .flags.ignore : true } }; }
 	_Istream_Cstr & ignore( _Istream_Cstr & fmt ) { fmt.flags.ignore = true; return fmt; }
 	_Istream_Cstr wdi( unsigned int w, char s[] ) { return (_Istream_Cstr)@{ s, 0p, w, { .all : 0 } }; }
Index: libcfa/src/stdlib.hfa
===================================================================
--- libcfa/src/stdlib.hfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ libcfa/src/stdlib.hfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -232,5 +232,5 @@
 		size_t osize = malloc_size( ptr );				// current allocation
 		size_t nsize = dim * sizeof(T);					// new allocation
-		T * nptr = realloc( ptr, align, nsize );		// CFA realloc
+		T * nptr = alloc_align( ptr, align, nsize );	// CFA alloc_align
 		if ( nsize > osize ) {							// larger ?
 			memset( (char *)nptr + osize, (int)fill, nsize - osize ); // initialize added storage
@@ -243,5 +243,5 @@
 		size_t nsize = dim * sizeof(T);					// new allocation
 		size_t ndim = nsize / sizeof(T);				// new dimension
-		T * nptr = realloc( ptr, align, nsize );		// CFA realloc
+		T * nptr = alloc_align( ptr, align, nsize );		// CFA alloc_align
 		if ( ndim > odim ) {							// larger ?
 			for ( i; odim ~ ndim ) {
Index: src/Common/ScopedMap.h
===================================================================
--- src/Common/ScopedMap.h	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ src/Common/ScopedMap.h	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -93,5 +93,5 @@
 
 		reference operator* () { return *it; }
-		pointer operator-> () { return it.operator->(); }
+		pointer operator-> () const { return it.operator->(); }
 
 		iterator& operator++ () {
Index: src/Concurrency/Keywords.cc
===================================================================
--- src/Concurrency/Keywords.cc	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ src/Concurrency/Keywords.cc	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -510,5 +510,6 @@
 						new CastExpr(
 							new VariableExpr( func->get_functionType()->get_parameters().front() ),
-							func->get_functionType()->get_parameters().front()->get_type()->stripReferences()->clone()
+							func->get_functionType()->get_parameters().front()->get_type()->stripReferences()->clone(),
+							false
 						)
 					)
@@ -888,5 +889,5 @@
 			new SingleInit( new UntypedExpr(
 				new NameExpr( "get_monitor" ),
-				{  new CastExpr( new VariableExpr( args.front() ), arg_type ) }
+				{  new CastExpr( new VariableExpr( args.front() ), arg_type, false ) }
 			))
 		);
@@ -909,5 +910,5 @@
 					{
 						new SingleInit( new AddressExpr( new VariableExpr( monitors ) ) ),
-						new SingleInit( new CastExpr( new VariableExpr( func ), generic_func->clone() ) )
+						new SingleInit( new CastExpr( new VariableExpr( func ), generic_func->clone(), false ) )
 					},
 					noDesignators,
@@ -946,5 +947,5 @@
 					return new SingleInit( new UntypedExpr(
 						new NameExpr( "get_monitor" ),
-						{  new CastExpr( new VariableExpr( var ), type ) }
+						{  new CastExpr( new VariableExpr( var ), type, false ) }
 					) );
 				})
@@ -970,5 +971,5 @@
 						new SingleInit( new VariableExpr( monitors ) ),
 						new SingleInit( new ConstantExpr( Constant::from_ulong( args.size() ) ) ),
-						new SingleInit( new CastExpr( new VariableExpr( func ), generic_func->clone() ) )
+						new SingleInit( new CastExpr( new VariableExpr( func ), generic_func->clone(), false ) )
 					},
 					noDesignators,
Index: src/Concurrency/Waitfor.cc
===================================================================
--- src/Concurrency/Waitfor.cc	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ src/Concurrency/Waitfor.cc	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -384,5 +384,6 @@
 								decl_monitor
 							)
-						)
+						),
+						false
 					);
 
@@ -408,5 +409,5 @@
 			new CompoundStmt({
 				makeAccStatement( acceptables, index, "is_dtor", detectIsDtor( clause.target.function )                                    , indexer ),
-				makeAccStatement( acceptables, index, "func"   , new CastExpr( clause.target.function, fptr_t )                            , indexer ),
+				makeAccStatement( acceptables, index, "func"   , new CastExpr( clause.target.function, fptr_t, false )                     , indexer ),
 				makeAccStatement( acceptables, index, "data"   , new VariableExpr( monitors )                                              , indexer ),
 				makeAccStatement( acceptables, index, "size"   , new ConstantExpr( Constant::from_ulong( clause.target.arguments.size() ) ), indexer ),
@@ -531,5 +532,6 @@
 								decl_mask
 							)
-						)
+						),
+						false
 					),
 					timeout
Index: src/Parser/ExpressionNode.cc
===================================================================
--- src/Parser/ExpressionNode.cc	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ src/Parser/ExpressionNode.cc	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -427,15 +427,15 @@
 		if ( str[1] == '8' ) goto Default;				// utf-8 characters => array of char
 		// lookup type of associated typedef
-		strtype = new TypeInstType( Type::Qualifiers( Type::Const ), "char16_t", false );
+		strtype = new TypeInstType( Type::Qualifiers( ), "char16_t", false );
 		break;
 	  case 'U':
-		strtype = new TypeInstType( Type::Qualifiers( Type::Const ), "char32_t", false );
+		strtype = new TypeInstType( Type::Qualifiers( ), "char32_t", false );
 		break;
 	  case 'L':
-		strtype = new TypeInstType( Type::Qualifiers( Type::Const ), "wchar_t", false );
+		strtype = new TypeInstType( Type::Qualifiers( ), "wchar_t", false );
 		break;
 	  Default:											// char default string type
 	  default:
-		strtype = new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char );
+		strtype = new BasicType( Type::Qualifiers( ), BasicType::Char );
 	} // switch
 	ArrayType * at = new ArrayType( noQualifiers, strtype,
Index: src/ResolvExpr/AlternativeFinder.cc
===================================================================
--- src/ResolvExpr/AlternativeFinder.cc	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ src/ResolvExpr/AlternativeFinder.cc	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -1216,6 +1216,8 @@
 			unify( castExpr->result, alt.expr->result, alt.env, needAssertions,
 				haveAssertions, openVars, indexer );
-			Cost thisCost = castCost( alt.expr->result, castExpr->result, alt.expr->get_lvalue(),
-				indexer, alt.env );
+			Cost thisCost =
+				castExpr->isGenerated
+				? conversionCost( alt.expr->result, castExpr->result, alt.expr->get_lvalue(),	indexer, alt.env )
+				: castCost( alt.expr->result, castExpr->result, alt.expr->get_lvalue(),	indexer, alt.env );
 			PRINT(
 				std::cerr << "working on cast with result: " << castExpr->result << std::endl;
@@ -1698,9 +1700,23 @@
 
 				// unification run for side-effects
-				unify( toType, alt.expr->result, newEnv, need, have, openVars, indexer );
+				bool canUnify = unify( toType, alt.expr->result, newEnv, need, have, openVars, indexer );
+				(void) canUnify;
 				// xxx - do some inspecting on this line... why isn't result bound to initAlt.type?
 
-				Cost thisCost = castCost( alt.expr->result, toType, alt.expr->get_lvalue(),
+				Cost thisCost = computeConversionCost( alt.expr->result, toType, alt.expr->get_lvalue(),
 					indexer, newEnv );
+
+				PRINT(
+					Cost legacyCost = castCost( alt.expr->result, toType, alt.expr->get_lvalue(),
+						indexer, newEnv );
+					std::cerr << "Considering initialization:";
+					std::cerr << std::endl << "  FROM: "; alt.expr->result->print(std::cerr);
+					std::cerr << std::endl << "  TO: ";   toType          ->print(std::cerr);
+					std::cerr << std::endl << "  Unification " << (canUnify ? "succeeded" : "failed");
+					std::cerr << std::endl << "  Legacy cost " << legacyCost;
+					std::cerr << std::endl << "  New cost " << thisCost;
+					std::cerr << std::endl;
+				)
+				
 				if ( thisCost != Cost::infinity ) {
 					// count one safe conversion for each value that is thrown away
Index: src/ResolvExpr/ConversionCost.cc
===================================================================
--- src/ResolvExpr/ConversionCost.cc	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ src/ResolvExpr/ConversionCost.cc	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -10,6 +10,6 @@
 // Created On       : Sun May 17 07:06:19 2015
 // Last Modified By : Andrew Beach
-// Last Modified On : Mon Aug 12 10:21:00 2019
-// Update Count     : 27
+// Last Modified On : Wed Jul 29 16:11:00 2020
+// Update Count     : 28
 //
 
@@ -392,20 +392,4 @@
 	void ConversionCost::postvisit( const FunctionType * ) {}
 
-	void ConversionCost::postvisit( const StructInstType * inst ) {
-		if ( const StructInstType * destAsInst = dynamic_cast< const StructInstType * >( dest ) ) {
-			if ( inst->name == destAsInst->name ) {
-				cost = Cost::zero;
-			} // if
-		} // if
-	}
-
-	void ConversionCost::postvisit( const UnionInstType * inst ) {
-		if ( const UnionInstType * destAsInst = dynamic_cast< const UnionInstType * >( dest ) ) {
-			if ( inst->name == destAsInst->name ) {
-				cost = Cost::zero;
-			} // if
-		} // if
-	}
-
 	void ConversionCost::postvisit( const EnumInstType * ) {
 		static Type::Qualifiers q;
@@ -681,22 +665,4 @@
 }
 
-void ConversionCost_new::postvisit( const ast::StructInstType * structInstType ) {
-	if ( const ast::StructInstType * dstAsInst =
-			dynamic_cast< const ast::StructInstType * >( dst ) ) {
-		if ( structInstType->name == dstAsInst->name ) {
-			cost = Cost::zero;
-		}
-	}
-}
-
-void ConversionCost_new::postvisit( const ast::UnionInstType * unionInstType ) {
-	if ( const ast::UnionInstType * dstAsInst =
-			dynamic_cast< const ast::UnionInstType * >( dst ) ) {
-		if ( unionInstType->name == dstAsInst->name ) {
-			cost = Cost::zero;
-		}
-	}
-}
-
 void ConversionCost_new::postvisit( const ast::EnumInstType * enumInstType ) {
 	(void)enumInstType;
Index: src/ResolvExpr/ConversionCost.h
===================================================================
--- src/ResolvExpr/ConversionCost.h	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ src/ResolvExpr/ConversionCost.h	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -10,6 +10,6 @@
 // Created On       : Sun May 17 09:37:28 2015
 // Last Modified By : Andrew Beach
-// Last Modified On : Thu Aug  8 16:13:00 2019
-// Update Count     : 6
+// Last Modified On : Wed Jul 29 16:12:00 2020
+// Update Count     : 7
 //
 
@@ -51,6 +51,4 @@
 		void postvisit( const ReferenceType * refType );
 		void postvisit( const FunctionType * functionType );
-		void postvisit( const StructInstType * aggregateUseType );
-		void postvisit( const UnionInstType * aggregateUseType );
 		void postvisit( const EnumInstType * aggregateUseType );
 		void postvisit( const TraitInstType * aggregateUseType );
@@ -102,6 +100,4 @@
 	void postvisit( const ast::ReferenceType * refType );
 	void postvisit( const ast::FunctionType * functionType );
-	void postvisit( const ast::StructInstType * structInstType );
-	void postvisit( const ast::UnionInstType * unionInstType );
 	void postvisit( const ast::EnumInstType * enumInstType );
 	void postvisit( const ast::TraitInstType * traitInstType );
Index: src/SynTree/Expression.h
===================================================================
--- src/SynTree/Expression.h	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ src/SynTree/Expression.h	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -206,5 +206,15 @@
   public:
 	Expression * arg;
-	bool isGenerated = true; // cast generated implicitly by code generation or explicit in program
+
+	// Inidicates cast is introduced by the CFA type system.
+	// true for casts that the resolver introduces to force a return type
+	// false for casts from user code
+	// false for casts from desugaring advanced CFA features into simpler CFA
+	// example
+	//   int * p;     // declaration
+	//   (float *) p; // use, with subject cast
+	// subject cast isGenerated means we are considering an interpretation with a type mismatch
+	// subject cast not isGenerated means someone in charge wants it that way
+	bool isGenerated = true;
 
 	CastExpr( Expression * arg, bool isGenerated = true );
Index: src/Virtual/ExpandCasts.cc
===================================================================
--- src/Virtual/ExpandCasts.cc	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ src/Virtual/ExpandCasts.cc	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -10,6 +10,6 @@
 // Created On       : Mon Jul 24 13:59:00 2017
 // Last Modified By : Andrew Beach
-// Last Modified On : Tue Jul 22 10:04:00 2020
-// Update Count     : 3
+// Last Modified On : Fri Jul 31 10:29:00 2020
+// Update Count     : 4
 //
 
@@ -18,9 +18,8 @@
 #include <cassert>                 // for assert, assertf
 #include <iterator>                // for back_inserter, inserter
-#include <map>                     // for map, _Rb_tree_iterator, map<>::ite...
 #include <string>                  // for string, allocator, operator==, ope...
-#include <utility>                 // for pair
 
 #include "Common/PassVisitor.h"    // for PassVisitor
+#include "Common/ScopedMap.h"      // for ScopedMap
 #include "Common/SemanticError.h"  // for SemanticError
 #include "SymTab/Mangler.h"        // for mangleType
@@ -37,6 +36,13 @@
 	/// Maps virtual table types the instance for that type.
 	class VirtualTableMap final {
-		std::unordered_map<std::string, ObjectDecl *> vtable_instances;
+		ScopedMap<std::string, ObjectDecl *> vtable_instances;
 	public:
+		void enterScope() {
+			vtable_instances.beginScope();
+		}
+		void leaveScope() {
+			vtable_instances.endScope();
+		}
+
 		ObjectDecl * insert( ObjectDecl * vtableDecl ) {
 			std::string const & mangledName = SymTab::Mangler::mangleType( vtableDecl->type );
@@ -93,8 +99,4 @@
 
 	class VirtualCastCore {
-		VirtualTableMap vtable_instances;
-		FunctionDecl *vcast_decl;
-		StructDecl *pvt_decl;
-
 		Type * pointer_to_pvt(int level_of_indirection) {
 			Type * type = new StructInstType(
@@ -108,5 +110,5 @@
 	public:
 		VirtualCastCore() :
-			vtable_instances(), vcast_decl( nullptr ), pvt_decl( nullptr )
+			indexer(), vcast_decl( nullptr ), pvt_decl( nullptr )
 		{}
 
@@ -116,4 +118,9 @@
 
 		Expression * postmutate( VirtualCastExpr * castExpr );
+
+		VirtualTableMap indexer;
+	private:
+		FunctionDecl *vcast_decl;
+		StructDecl *pvt_decl;
 	};
 
@@ -135,5 +142,5 @@
 	void VirtualCastCore::premutate( ObjectDecl * objectDecl ) {
 		if ( is_vtable_inst_name( objectDecl->get_name() ) ) {
-			if ( ObjectDecl * existing = vtable_instances.insert( objectDecl ) ) {
+			if ( ObjectDecl * existing = indexer.insert( objectDecl ) ) {
 				std::string msg = "Repeated instance of virtual table, original found at: ";
 				msg += existing->location.filename;
@@ -222,5 +229,5 @@
 
 		const Type * vtable_type = getVirtualTableType( castExpr );
-		ObjectDecl * table = vtable_instances.lookup( vtable_type );
+		ObjectDecl * table = indexer.lookup( vtable_type );
 		if ( nullptr == table ) {
 			SemanticError( castLocation( castExpr ),
Index: tests/.expect/castError.txt
===================================================================
--- tests/.expect/castError.txt	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ tests/.expect/castError.txt	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -1,3 +1,3 @@
-castError.cfa:21:1 error: Cannot choose between 3 alternatives for expression
+castError.cfa:23:1 error: Cannot choose between 3 alternatives for expression
 Explicit Cast of:
   Name: f
@@ -35,5 +35,5 @@
 
 
-castError.cfa:26:1 error: Cannot choose between 2 alternatives for expression
+castError.cfa:28:1 error: Cannot choose between 2 alternatives for expression
 Generated Cast of:
   Comma Expression:
@@ -62,2 +62,9 @@
 
 
+castError.cfa:30:1 error: No reasonable alternatives for expression Explicit Cast of:
+  Name: sint
+... to:
+  instance of struct S with body 1
+  ... with parameters
+    char
+
Index: tests/.expect/init1.txt
===================================================================
--- tests/.expect/init1.txt	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
+++ tests/.expect/init1.txt	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -0,0 +1,47 @@
+error: No reasonable alternatives for expression Untyped Init Expression
+  Name: rx  InitAlternative: reference to signed int
+error: No reasonable alternatives for expression Untyped Init Expression
+  Name: px  InitAlternative: pointer to signed int
+error: No reasonable alternatives for expression Untyped Init Expression
+  Name: crx  InitAlternative: reference to float
+error: No reasonable alternatives for expression Untyped Init Expression
+  Name: cpx  InitAlternative: pointer to float
+init1.cfa:94:1 error: No reasonable alternatives for expression Generated Cast of:
+  Name: rx
+... to:
+  reference to signed int
+init1.cfa:97:1 error: No reasonable alternatives for expression Applying untyped:
+  Name: ?{}
+...to:
+  Generated Cast of:
+    Variable Expression: _retval_f_py: pointer to signed int
+  ... to:
+    reference to pointer to signed int
+  Name: px
+
+init1.cfa:104:1 error: No reasonable alternatives for expression Generated Cast of:
+  Name: crx
+... to:
+  reference to float
+init1.cfa:107:1 error: No reasonable alternatives for expression Applying untyped:
+  Name: ?{}
+...to:
+  Generated Cast of:
+    Variable Expression: _retval_f_py2: pointer to float
+  ... to:
+    reference to pointer to float
+  Name: cpx
+
+init1.cfa:114:1 error: No reasonable alternatives for expression Generated Cast of:
+  Name: s
+... to:
+  reference to instance of type T (not function type)
+init1.cfa:118:1 error: No reasonable alternatives for expression Applying untyped:
+  Name: ?{}
+...to:
+  Generated Cast of:
+    Variable Expression: _retval_anycvt: pointer to instance of type T (not function type)
+  ... to:
+    reference to pointer to instance of type T (not function type)
+  Name: s
+
Index: tests/avltree/avl1.cfa
===================================================================
--- tests/avltree/avl1.cfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ tests/avltree/avl1.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -24,5 +24,5 @@
 tree(K, V) * create(K key, V value) {
   // infinite loop trying to resolve ... t = malloc();
-  tree(K, V) * t = malloc(sizeof(tree(K,V)));
+  tree(K, V) * t = ( tree(K, V) * ) malloc(sizeof(tree(K,V)));
   (*t){ key, value };
   return t;
Index: tests/bugs/140.cfa
===================================================================
--- tests/bugs/140.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
+++ tests/bugs/140.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -0,0 +1,10 @@
+// Trac Ticket: https://cforall.uwaterloo.ca/trac/ticket/140
+
+#include <stdio.h>
+
+int main() {
+	char c[1] = { 3 };
+	int i = 4;
+	int r = 3 < 4 ? c[0] : i;
+	printf( "%d\n", r );
+}
Index: tests/bugs/203-2.cfa
===================================================================
--- tests/bugs/203-2.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
+++ tests/bugs/203-2.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -0,0 +1,16 @@
+// Trac ticket: https://cforall.uwaterloo.ca/trac/ticket/203
+
+forall(dtype A)
+struct empty {
+	// Nothing.
+};
+
+forall(dtype C)
+struct wrap_e {
+	empty(C) field;
+};
+
+empty(int) empty_obj;
+empty(char) empty_obj;
+
+wrap_e(char) outer_obj @= { empty_obj };
Index: tests/bugs/203-7.cfa
===================================================================
--- tests/bugs/203-7.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
+++ tests/bugs/203-7.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -0,0 +1,13 @@
+// Trac ticket: https://cforall.uwaterloo.ca/trac/ticket/203
+
+forall(dtype A)
+struct empty {
+	// Nothing.
+};
+
+forall(dtype C)
+struct wrap_e {
+	empty(C) field;
+};
+
+wrap_e(bool) error_obj = { {} };
Index: tests/bugs/203-9.cfa
===================================================================
--- tests/bugs/203-9.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
+++ tests/bugs/203-9.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -0,0 +1,13 @@
+// Trac ticket: https://cforall.uwaterloo.ca/trac/ticket/203
+
+forall(dtype A)
+struct empty {
+	// Nothing.
+};
+
+forall(dtype C)
+struct wrap_e {
+	empty(C) field;
+};
+
+wrap_e(bool) error_obj @= { {} };
Index: tests/bugs/66.cfa
===================================================================
--- tests/bugs/66.cfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ tests/bugs/66.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -5,5 +5,5 @@
 
 int main() {
-	int * next = (void*)0;
+	int * next = 0p;
 	if( next ) {
 		return 1;
Index: tests/castError.cfa
===================================================================
--- tests/castError.cfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ tests/castError.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -14,5 +14,7 @@
 // 
 
+forall(otype T) struct S { T p; };
 int f;
+S(int) sint;
 
 void f() {
@@ -25,4 +27,6 @@
 	short int v;
 	3, v;		// implicit void cast
+
+	(S(char)) sint;
 }
 
Index: tests/concurrent/signal/block.cfa
===================================================================
--- tests/concurrent/signal/block.cfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ tests/concurrent/signal/block.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -82,5 +82,5 @@
 	if( !is_empty( cond ) ) {
 
-		$thread * next = front( cond );
+		$thread * next = ( $thread * ) front( cond );
 
 		if( ! signal_block( cond ) ) {
Index: tests/exceptions/conditional.cfa
===================================================================
--- tests/exceptions/conditional.cfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ tests/exceptions/conditional.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -17,5 +17,5 @@
 };
 
-void num_error_msg(num_error * this) {
+const char * num_error_msg(num_error * this) {
     if ( ! this->msg ) {
         static const char * base = "Num Error with code: X";
Index: tests/exceptions/defaults.cfa
===================================================================
--- tests/exceptions/defaults.cfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ tests/exceptions/defaults.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -13,5 +13,5 @@
 }
 
-char * get_log_message(log_message * this) {
+const char * get_log_message(log_message * this) {
 	return this->msg;
 }
@@ -28,10 +28,10 @@
 	// We can catch log:
 	try {
-		throwResume (log_message){(char *)"Should be printed.\n"};
+		throwResume (log_message){"Should be printed.\n"};
 	} catchResume (log_message * this) {
 		printf("%s", this->virtual_table->msg(this));
 	}
 	// But we don't have to:
-	throwResume (log_message){(char *)"Should not be printed.\n"};
+	throwResume (log_message){"Should not be printed.\n"};
 }
 
Index: tests/init1.cfa
===================================================================
--- tests/init1.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
+++ tests/init1.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -0,0 +1,120 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2020 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// init1.cfa -- tests of initializing pointer- and reference-typed variables and returns
+//
+// Author           : Michael Brooks
+// Created On       : Thu Jul 16 22:00:00 2020
+// Last Modified By : Michael Brooks
+// Last Modified On : Thu Jul 16 22:00:00 2020
+// Update Count     : 1
+//
+
+void f() {
+
+    //
+    // setup
+    //
+
+    float x = 3.14;
+
+    float & rx = x;
+    float * px = &x;
+
+    const float & crx = x;
+    const float * cpx = &x;
+
+    //
+    // sound initializations
+    //
+
+    char * str1 = "hi";
+    const char * str2 = "hi";
+
+    float & rx2 = rx;
+    float * px2 = px;
+
+    const float & crx2 = crx;
+    const float * cpx2 = cpx;
+
+    //
+    // unsound initializations
+    //
+
+    // mismatched referenced type
+    int & ry = rx;
+    int * py = px;
+
+    // would discard refered constness (same float is referenced)
+    float & ry2 = crx;
+    float * py2 = cpx;
+}
+
+//
+// sound returns
+//
+
+char * f_str1() {
+    return "hi";
+}
+
+const char * f_str2() {
+    return "hi";
+}
+
+float & f_rx2 () {
+    float & rx = *0p;
+    return rx;
+}
+
+float * f_px2 () {
+    float * px = 0p;
+    return px;
+}
+
+const float & f_crx2 () {
+    float & rx = *0p;
+    return rx;
+}
+
+const float * f_cpx2 () {
+    float * px = 0p;
+    return px;
+}
+
+//
+// unsound returns
+//
+
+int & f_ry() { 
+    float & rx = *0p;
+    return rx;               // mismatched referenced type
+}
+
+int * f_py() {
+    float * px = 0p;
+    return px;               // mismatched referenced type
+}
+
+float & f_ry2() {
+    const float & crx = *0p;
+    return crx;              // would discard refered constness (same float is referenced)
+}
+
+float * f_py2() {
+    const float * cpx = 0p;
+    return cpx;              // would discard refered constness (same float is referenced)
+}
+
+forall (dtype T, dtype S)
+T & anycvt( S & s ) {
+    return s;               // mismatched referenced type
+}
+
+forall (dtype T, dtype S)
+T * anycvt( S * s ) {
+    return s;               // mismatched referenced type
+}
Index: tests/io2.cfa
===================================================================
--- tests/io2.cfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ tests/io2.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -121,5 +121,5 @@
 
 	[int, int, const char *, double] t3 = { 3, 4, "a", 7.2 };
-	sout | [ 3, 4, "a", 7.2 ];
+	sout | [ 3, 4, (const char*)"a", 7.2 ];             // workaround trac#207: the const cast should not be needed
 	sout | t3;
 	sepSetTuple( sout, " " );
Index: tests/searchsort.cfa
===================================================================
--- tests/searchsort.cfa	(revision 3e2b9c93dff631bddb430d876a83bcc3bafe9d16)
+++ tests/searchsort.cfa	(revision 95789be69da1e578ec7ea697904a12ffc63b0263)
@@ -38,7 +38,7 @@
 	} // for
 	sout | nl;
-	for ( i; 0 ~ size ) {		// C version
+	for ( i; 0 ~ size ) {		// C version, returns void*
 		int key = size - i;
-		int * v = bsearch( &key, iarr, size, sizeof( iarr[0] ), comp );
+		int * v = ( int * ) bsearch( &key, iarr, size, sizeof( iarr[0] ), comp );
 		sout | key | ':' | *v | ", ";
 	} // for
