Index: src/CodeGen/CodeGenerator.cc
===================================================================
--- src/CodeGen/CodeGenerator.cc	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/CodeGen/CodeGenerator.cc	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -806,5 +806,5 @@
 
 		for ( std::list< Label >::iterator i = l.begin(); i != l.end(); i++ )
-			str += *i + ": ";
+			str += (*i).get_name() + ": ";
 
 		return str;
Index: src/ControlStruct/LabelFixer.cc
===================================================================
--- src/ControlStruct/LabelFixer.cc	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/ControlStruct/LabelFixer.cc	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// LabelFixer.cc -- 
+// LabelFixer.cc --
 //
 // Author           : Rodolfo G. Esteves
@@ -86,5 +86,5 @@
 
 
-	// sets the definition of the labelTable entry to be the provided 
+	// sets the definition of the labelTable entry to be the provided
 	// statement for every label in the list parameter. Happens for every kind of statement
 	Label LabelFixer::setLabelsDef( std::list< Label > &llabel, Statement *definition ) {
@@ -101,5 +101,5 @@
 			} else if ( labelTable[ *i ]->defined() ) {
 				// defined twice, error
-				throw SemanticError( "Duplicate definition of label: " + *i );
+				throw SemanticError( "Duplicate definition of label: " + (*i).get_name() );
 			}	else {
 				// used previously, but undefined until now -> link with this entry
@@ -109,5 +109,5 @@
 		} // for
 
-		// produce one of the labels attached to this statement to be 
+		// produce one of the labels attached to this statement to be
 		// temporarily used as the canonical label
 		return labelTable[ llabel.front() ]->get_label();
@@ -130,5 +130,5 @@
 		for ( std::map< Label, Entry * >::iterator i = labelTable.begin(); i != labelTable.end(); ++i ) {
 			if ( ! i->second->defined() ) {
-				throw SemanticError( "Use of undefined label: " + i->first );
+				throw SemanticError( "Use of undefined label: " + i->first.get_name() );
 			}
 			(*ret)[ i->first ] = i->second->get_definition();
Index: src/ControlStruct/LabelFixer.h
===================================================================
--- src/ControlStruct/LabelFixer.h	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/ControlStruct/LabelFixer.h	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// LabelFixer.h -- 
+// LabelFixer.h --
 //
 // Author           : Rodolfo G. Esteves
@@ -20,6 +20,6 @@
 #include "SynTree/SynTree.h"
 #include "SynTree/Visitor.h"
+#include "SynTree/Label.h"
 #include "LabelGenerator.h"
-
 #include <map>
 
@@ -74,8 +74,8 @@
 
 		  private:
-			Label label;  
+			Label label;
 			Statement *definition;
 		};
-	          
+
 		std::map < Label, Entry *> labelTable;
 		LabelGenerator *generator;
Index: src/ControlStruct/LabelGenerator.cc
===================================================================
--- src/ControlStruct/LabelGenerator.cc	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/ControlStruct/LabelGenerator.cc	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// LabelGenerator.cc -- 
+// LabelGenerator.cc --
 //
 // Author           : Rodolfo G. Esteves
@@ -18,4 +18,5 @@
 
 #include "LabelGenerator.h"
+#include "SynTree/Label.h"
 
 namespace ControlStruct {
Index: src/ControlStruct/MLEMutator.h
===================================================================
--- src/ControlStruct/MLEMutator.h	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/ControlStruct/MLEMutator.h	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// MLEMutator.h -- 
+// MLEMutator.h --
 //
 // Author           : Rodolfo G. Esteves
@@ -23,4 +23,5 @@
 #include "SynTree/SynTree.h"
 #include "SynTree/Mutator.h"
+#include "SynTree/Label.h"
 
 #include "LabelGenerator.h"
@@ -38,5 +39,5 @@
 		Statement *mutate( BranchStmt *branchStmt ) throw ( SemanticError );
 
-		Statement *mutate( CaseStmt *caseStmt ); 
+		Statement *mutate( CaseStmt *caseStmt );
 		Statement *mutate( SwitchStmt *switchStmt );
 		Statement *mutate( ChooseStmt *switchStmt );
@@ -79,5 +80,5 @@
 		Statement *handleLoopStmt( LoopClass *loopStmt );
 
-		template< typename SwitchClass > 
+		template< typename SwitchClass >
 		Statement *handleSwitchStmt( SwitchClass *switchStmt );
 
Index: src/GenPoly/Specialize.cc
===================================================================
--- src/GenPoly/Specialize.cc	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/GenPoly/Specialize.cc	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -99,5 +99,5 @@
 		} // if
 		// create new thunk with same signature as formal type (C linkage, empty body)
-		FunctionDecl *thunkFunc = new FunctionDecl( thunkNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, newType, new CompoundStmt( std::list< std::string >() ), false, false );
+		FunctionDecl *thunkFunc = new FunctionDecl( thunkNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, newType, new CompoundStmt( noLabels ), false, false );
 		thunkFunc->fixUniqueId();
 
Index: src/InitTweak/FixInit.cc
===================================================================
--- src/InitTweak/FixInit.cc	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/InitTweak/FixInit.cc	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -281,5 +281,5 @@
 		PRINT( std::cerr << "Coming out the back..." << impCpCtorExpr << std::endl; )
 
-		// xxx - some of these aren't necessary, and can be removed once this is stable
+		// detach fields from wrapper node so that it can be deleted without deleting too much
 		dtors.clear();
 		tempDecls.clear();
Index: src/InitTweak/InitTweak.cc
===================================================================
--- src/InitTweak/InitTweak.cc	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/InitTweak/InitTweak.cc	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -115,11 +115,11 @@
 
 	namespace {
-		template<typename CallExpr>
-		std::string funcName( CallExpr * expr ) {
-			Expression * func = expr->get_function();
+		std::string funcName( Expression * func ) {
 			if ( NameExpr * nameExpr = dynamic_cast< NameExpr * >( func ) ) {
 				return nameExpr->get_name();
 			} else if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( func ) ) {
 				return varExpr->get_var()->get_name();
+			}	else if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( func ) ) {
+				return funcName( castExpr->get_arg() );
 			} else {
 				assert( false && "Unexpected expression type being called as a function in call expression" );
@@ -130,8 +130,9 @@
 	std::string getFunctionName( Expression * expr ) {
 		if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr ) ) {
-			return funcName( appExpr );
+			return funcName( appExpr->get_function() );
 		} else if ( UntypedExpr * untypedExpr = dynamic_cast< UntypedExpr * > ( expr ) ) {
-			return funcName( untypedExpr );
+			return funcName( untypedExpr->get_function() );
 		} else {
+			std::cerr << expr << std::endl;
 			assert( false && "Unexpected expression type passed to getFunctionName" );
 		}
Index: src/Parser/ParseNode.h
===================================================================
--- src/Parser/ParseNode.h	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/Parser/ParseNode.h	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -28,4 +28,5 @@
 //#include "SynTree/Declaration.h"
 #include "Common/UniqueName.h"
+#include "SynTree/Label.h"
 
 class ExpressionNode;
@@ -284,8 +285,8 @@
 	virtual void printOneLine( std::ostream &, int indent = 0) const;
 
-	const std::list< std::string > &get_labels() const { return labels; };
+	const std::list< Label > &get_labels() const { return labels; };
 	void append_label( std::string *label ) { labels.push_back( *label ); delete label; }
   private:
-	std::list< std::string > labels;
+	std::list< Label > labels;
 };
 
@@ -524,5 +525,5 @@
 	ExpressionNode *output, *input;
 	ConstantNode *clobber;
-	std::list<std::string> gotolabels;
+	std::list< Label > gotolabels;
 };
 
Index: src/Parser/StatementNode.cc
===================================================================
--- src/Parser/StatementNode.cc	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/Parser/StatementNode.cc	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// StatementNode.cc -- 
+// StatementNode.cc --
 //
 // Author           : Rodolfo G. Esteves
@@ -27,6 +27,6 @@
 
 const char *StatementNode::StType[] = {
-	"Exp",   "If",       "Switch", "Case",    "Default",  "Choose",   "Fallthru", 
-	"While", "Do",       "For", 
+	"Exp",   "If",       "Switch", "Case",    "Default",  "Choose",   "Fallthru",
+	"While", "Do",       "For",
 	"Goto",  "Continue", "Break",  "Return",  "Throw",
 	"Try",   "Catch",    "Finally", "Asm",
@@ -62,5 +62,5 @@
 StatementNode::StatementNode( Type t, ExpressionNode *ctrl_label, StatementNode *block ) : type( t ), control( ctrl_label ), block( block ), labels( 0 ), target( 0 ), decl( 0 ), isCatchRest ( false ) {
 	this->control = ( t == Default ) ? 0 : control;
-} 
+}
 
 StatementNode::StatementNode( Type t, string *target ) : type( t ), control( 0 ), block( 0 ), labels( 0 ), target( target ), decl( 0 ), isCatchRest ( false ) {}
@@ -74,5 +74,5 @@
 
 StatementNode * StatementNode::newCatchStmt( DeclarationNode *d, StatementNode *s, bool catchRestP ) {
-	StatementNode *ret = new StatementNode( StatementNode::Catch, 0, s ); 
+	StatementNode *ret = new StatementNode( StatementNode::Catch, 0, s );
 	ret->addDeclaration( d );
 	ret->setCatchRest( catchRestP );
@@ -101,5 +101,5 @@
 StatementNode *StatementNode::add_label( const std::string *l ) {
 	if ( l != 0 ) {
-		labels.push_front( *l ); 
+		labels.push_front( *l );
 		delete l;
 	} // if
@@ -156,5 +156,5 @@
 			control->print( os, indent );
 			os << endl;
-		} else 
+		} else
 			os << string( indent, ' ' ) << "Null Statement" << endl;
 		break;
@@ -177,5 +177,5 @@
 		if ( block ) {
 			os << string( indent + ParseNode::indent_by, ' ' ) << "Branches of execution: " << endl;
-			block->printList( os, indent + 2 * ParseNode::indent_by );  
+			block->printList( os, indent + 2 * ParseNode::indent_by );
 		} // if
 		if ( target ) {
@@ -258,5 +258,5 @@
 	  case Fallthru:
 		return new FallthruStmt( labs );
-	  case Case: 
+	  case Case:
 		return new CaseStmt( labs, maybeBuild<Expression>(get_control()), branches );
 	  case Default:
@@ -394,5 +394,5 @@
 		os << string( indent + ParseNode::indent_by, ' ' ) << "Goto Labels:" << endl;
 		os << string( indent + 2 * ParseNode::indent_by, ' ' );
-		for ( std::list<std::string>::const_iterator i = gotolabels.begin();; ) {
+		for ( std::list<Label>::const_iterator i = gotolabels.begin();; ) {
 			os << *i;
 			i++;
@@ -426,5 +426,5 @@
 }
 
-Statement *NullStmtNode::build() const { 
+Statement *NullStmtNode::build() const {
 	return new NullStmt;
 }
Index: src/SymTab/Autogen.cc
===================================================================
--- src/SymTab/Autogen.cc	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/SymTab/Autogen.cc	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -482,4 +482,6 @@
 		ObjectDecl *dst = new ObjectDecl( "_dst", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), typeInst->clone() ), 0 );
 		if ( typeDecl->get_base() ) {
+			// xxx - generate ctor/dtors for typedecls, e.g.
+			// otype T = int *;
 			stmts = new CompoundStmt( std::list< Label >() );
 			UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) );
Index: src/SymTab/Autogen.h
===================================================================
--- src/SymTab/Autogen.h	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/SymTab/Autogen.h	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -24,6 +24,4 @@
 
 namespace SymTab {
-  static const std::list< std::string > noLabels;
-
   /// Generates assignment operators, constructors, and destructor for aggregate types as required
   void autogenerateRoutines( std::list< Declaration * > &translationUnit );
Index: src/SynTree/Statement.cc
===================================================================
--- src/SynTree/Statement.cc	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/SynTree/Statement.cc	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -87,5 +87,5 @@
 	Statement( labels ), originalTarget( _target ), target( _target ), computedTarget( NULL ), type( _type ) {
 	//actually this is a syntactic error signaled by the parser
-	if ( type == BranchStmt::Goto && target.size() == 0 )
+	if ( type == BranchStmt::Goto && target.empty() )
 		throw SemanticError("goto without target");
 }
Index: src/SynTree/Statement.h
===================================================================
--- src/SynTree/Statement.h	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/SynTree/Statement.h	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -22,4 +22,5 @@
 #include "Common/SemanticError.h"
 #include "Type.h"
+#include "Label.h"
 
 class Statement {
Index: src/SynTree/SynTree.h
===================================================================
--- src/SynTree/SynTree.h	(revision 3c1d702d920469dcdb821b08109a3587620e518f)
+++ src/SynTree/SynTree.h	(revision 14d2bdfe5b0ca66a20e4680e0a31eae02e382786)
@@ -113,5 +113,6 @@
 class Constant;
 
-typedef std::string Label;
+// typedef std::string Label;
+class Label;
 typedef unsigned int UniqueId;
 
