Index: src/ResolvExpr/AlternativeFinder.cc
===================================================================
--- src/ResolvExpr/AlternativeFinder.cc	(revision 448f9b2ed27be828cc42a883f1d854f5d37cc613)
+++ src/ResolvExpr/AlternativeFinder.cc	(revision 49205cfb46b9e8b764eb9b51622c7760bedcae1b)
@@ -9,7 +9,7 @@
 // Author           : Richard C. Bilson
 // Created On       : Sat May 16 23:52:08 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Sat May 16 23:55:30 2015
-// Update Count     : 3
+// Last Modified By : Rob Schluntz
+// Last Modified On : Thu May 21 16:21:09 2015
+// Update Count     : 12
 //
 
@@ -107,11 +107,11 @@
 						PRINT(
 							std::cout << "cost " << candidate->cost << " beats " << mapPlace->second.candidate->cost << std::endl;
-							)
-							selected[ mangleName ] = current;
+						)
+						selected[ mangleName ] = current;
 					} else if ( candidate->cost == mapPlace->second.candidate->cost ) {
 						PRINT(
 							std::cout << "marking ambiguous" << std::endl;
-							)
-							mapPlace->second.isAmbiguous = true;
+						)
+						mapPlace->second.isAmbiguous = true;
 					}
 				} else {
@@ -122,16 +122,16 @@
 			PRINT(
 				std::cout << "there are " << selected.size() << " alternatives before elimination" << std::endl;
-				)
-
-				// accept the alternatives that were unambiguous
-				for ( std::map< std::string, PruneStruct >::iterator target = selected.begin(); target != selected.end(); ++target ) {
-					if ( ! target->second.isAmbiguous ) {
-						Alternative &alt = *target->second.candidate;
-						for ( std::list< Type* >::iterator result = alt.expr->get_results().begin(); result != alt.expr->get_results().end(); ++result ) {
-							alt.env.applyFree( *result );
-						}
-						*out++ = alt;
+			)
+
+			// accept the alternatives that were unambiguous
+			for ( std::map< std::string, PruneStruct >::iterator target = selected.begin(); target != selected.end(); ++target ) {
+				if ( ! target->second.isAmbiguous ) {
+					Alternative &alt = *target->second.candidate;
+					for ( std::list< Type* >::iterator result = alt.expr->get_results().begin(); result != alt.expr->get_results().end(); ++result ) {
+						alt.env.applyFree( *result );
 					}
-				}
+					*out++ = alt;
+				}
+			}
 
 		}
@@ -183,6 +183,6 @@
 				std::cout << "findSubExprs" << std::endl;
 				printAlts( finder.alternatives, std::cout );
-				)
-				*out++ = finder;
+			)
+			*out++ = finder;
 		}
 	}
@@ -205,6 +205,6 @@
 			std::cout << "alternatives before prune:" << std::endl;
 			printAlts( alternatives, std::cout );
-			)
-			AltList::iterator oldBegin = alternatives.begin();
+		)
+		AltList::iterator oldBegin = alternatives.begin();
 		pruneAlternatives( alternatives.begin(), alternatives.end(), front_inserter( alternatives ), indexer );
 		if ( alternatives.begin() == oldBegin ) {
@@ -221,6 +221,6 @@
 		PRINT(
 			std::cout << "there are " << alternatives.size() << " alternatives after elimination" << std::endl;
-			)
-			}
+		)
+	}
 
 	void AlternativeFinder::findWithAdjustment( Expression *expr ) {
@@ -264,6 +264,6 @@
 				std::cout << "--- results are" << std::endl;
 				printAll( (*actualExpr)->get_results(), std::cout, 8 );
-				)
-				std::list< DeclarationWithType* >::iterator startFormal = formal;
+			)
+			std::list< DeclarationWithType* >::iterator startFormal = formal;
 			Cost actualCost;
 			for ( std::list< Type* >::iterator actual = (*actualExpr)->get_results().begin(); actual != (*actualExpr)->get_results().end(); ++actual ) {
@@ -281,13 +281,13 @@
 					std::cout << std::endl << " to ";
 					(*formal)->get_type()->print( std::cout, 8 );
-					)
-					Cost newCost = conversionCost( *actual, (*formal)->get_type(), indexer, alt.env );
+				)
+				Cost newCost = conversionCost( *actual, (*formal)->get_type(), indexer, alt.env );
 				PRINT(
 					std::cout << std::endl << "cost is" << newCost << std::endl;
-					)
-
-					if ( newCost == Cost::infinity ) {
-						return newCost;
-					}
+				)
+
+				if ( newCost == Cost::infinity ) {
+					return newCost;
+				}
 				convCost += newCost;
 				actualCost += newCost;
@@ -381,8 +381,8 @@
 					(*actual)->print( std::cerr );
 					std::cerr << std::endl;
-					)
-					if ( ! unify( (*formal)->get_type(), *actual, resultEnv, resultNeed, resultHave, openVars, indexer ) ) {
-						return false;
-					}
+				)
+				if ( ! unify( (*formal)->get_type(), *actual, resultEnv, resultNeed, resultHave, openVars, indexer ) ) {
+					return false;
+				}
 				formal++;
 			}
@@ -429,6 +429,6 @@
 					std::cerr << "recursing with new set:" << std::endl;
 					printAssertionSet( newNeed, std::cerr, 8 );
-					)
-					inferRecursive( newNeed.begin(), newNeed.end(), newAlt, openVars, decls, newerNeed, level+1, indexer, out );
+				)
+				inferRecursive( newNeed.begin(), newNeed.end(), newAlt, openVars, decls, newerNeed, level+1, indexer, out );
 				return;
 			}
@@ -444,6 +444,6 @@
 			curDecl->print( std::cerr );
 			std::cerr << std::endl;
-			)
-			std::list< DeclarationWithType* > candidates;
+		)
+		std::list< DeclarationWithType* > candidates;
 		decls.lookupId( curDecl->get_name(), candidates );
 ///   if ( candidates.empty() ) { std::cout << "no candidates!" << std::endl; }
@@ -453,6 +453,6 @@
 				(*candidate)->print( std::cout );
 				std::cout << std::endl;
-				)
-				AssertionSet newHave, newerNeed( newNeed );
+			)
+			AssertionSet newHave, newerNeed( newNeed );
 			TypeEnvironment newEnv( newAlt.env );
 			OpenVarSet newOpenVars( openVars );
@@ -466,32 +466,32 @@
 				adjType->print( std::cerr );
 				std::cerr << std::endl;
+			)
+			if ( unify( curDecl->get_type(), adjType, newEnv, newerNeed, newHave, newOpenVars, indexer ) ) {
+				PRINT(
+					std::cerr << "success!" << std::endl;
 				)
-				if ( unify( curDecl->get_type(), adjType, newEnv, newerNeed, newHave, newOpenVars, indexer ) ) {
-					PRINT(
-						std::cerr << "success!" << std::endl;
-						)
-						SymTab::Indexer newDecls( decls );
-					addToIndexer( newHave, newDecls );
-					Alternative newerAlt( newAlt );
-					newerAlt.env = newEnv;
-					assert( (*candidate)->get_uniqueId() );
-					Expression *varExpr = new VariableExpr( static_cast< DeclarationWithType* >( Declaration::declFromId( (*candidate)->get_uniqueId() ) ) );
-					deleteAll( varExpr->get_results() );
-					varExpr->get_results().clear();
-					varExpr->get_results().push_front( adjType->clone() );
-					PRINT(
-						std::cout << "satisfying assertion " << curDecl->get_uniqueId() << " ";
-						curDecl->print( std::cout );
-						std::cout << " with declaration " << (*candidate)->get_uniqueId() << " ";
-						(*candidate)->print( std::cout );
-						std::cout << std::endl;
-						)
-						ApplicationExpr *appExpr = static_cast< ApplicationExpr* >( newerAlt.expr );
-					// XXX: this is a memory leak, but adjType can't be deleted because it might contain assertions
-					appExpr->get_inferParams()[ curDecl->get_uniqueId() ] = ParamEntry( (*candidate)->get_uniqueId(), adjType->clone(), curDecl->get_type()->clone(), varExpr );
-					inferRecursive( begin, end, newerAlt, newOpenVars, newDecls, newerNeed, level, indexer, out );
-				} else {
-					delete adjType;
-				}
+				SymTab::Indexer newDecls( decls );
+				addToIndexer( newHave, newDecls );
+				Alternative newerAlt( newAlt );
+				newerAlt.env = newEnv;
+				assert( (*candidate)->get_uniqueId() );
+				Expression *varExpr = new VariableExpr( static_cast< DeclarationWithType* >( Declaration::declFromId( (*candidate)->get_uniqueId() ) ) );
+				deleteAll( varExpr->get_results() );
+				varExpr->get_results().clear();
+				varExpr->get_results().push_front( adjType->clone() );
+				PRINT(
+					std::cout << "satisfying assertion " << curDecl->get_uniqueId() << " ";
+					curDecl->print( std::cout );
+					std::cout << " with declaration " << (*candidate)->get_uniqueId() << " ";
+					(*candidate)->print( std::cout );
+					std::cout << std::endl;
+				)
+				ApplicationExpr *appExpr = static_cast< ApplicationExpr* >( newerAlt.expr );
+				// XXX: this is a memory leak, but adjType can't be deleted because it might contain assertions
+				appExpr->get_inferParams()[ curDecl->get_uniqueId() ] = ParamEntry( (*candidate)->get_uniqueId(), adjType->clone(), curDecl->get_type()->clone(), varExpr );
+				inferRecursive( begin, end, newerAlt, newOpenVars, newDecls, newerNeed, level, indexer, out );
+			} else {
+				delete adjType;
+			}
 		}
 	}
@@ -509,6 +509,6 @@
 			std::cout << "============= new indexer" << std::endl;
 			decls.print( std::cout );
-			)
-			addToIndexer( have, decls );
+		)
+		addToIndexer( have, decls );
 		AssertionSet newNeed;
 		inferRecursive( need.begin(), need.end(), newAlt, openVars, decls, newNeed, 0, indexer, out );
@@ -533,6 +533,6 @@
 				std::cout << "need assertions:" << std::endl;
 				printAssertionSet( resultNeed, std::cout, 8 );
-				)
-				inferParameters( resultNeed, resultHave, newAlt, openVars, out );
+			)
+			inferParameters( resultNeed, resultHave, newAlt, openVars, out );
 		}
 	}
@@ -570,7 +570,7 @@
 				std::cout << "working on alternative: " << std::endl;
 				func->print( std::cout, 8 );
-				)
-				// check if the type is pointer to function
-				PointerType *pointer;
+			)
+			// check if the type is pointer to function
+			PointerType *pointer;
 			if ( func->expr->get_results().size() == 1 && ( pointer = dynamic_cast< PointerType* >( func->expr->get_results().front() ) ) ) {
 				if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) {
@@ -603,6 +603,6 @@
 						std::cout << "known function ops:" << std::endl;
 						printAlts( funcOpFinder.alternatives, std::cout, 8 );
-						)
-						}
+					)
+				}
 
 				for ( AltList::const_iterator funcOp = funcOpFinder.alternatives.begin(); funcOp != funcOpFinder.alternatives.end(); ++funcOp ) {
@@ -642,9 +642,9 @@
 				withFunc->env.print( std::cout, 8 );
 				std::cout << "cost of conversion is:" << cvtCost << std::endl;
-				)
-				if ( cvtCost != Cost::infinity ) {
-					withFunc->cvtCost = cvtCost;
-					alternatives.push_back( *withFunc );
-				} // if
+			)
+			if ( cvtCost != Cost::infinity ) {
+				withFunc->cvtCost = cvtCost;
+				alternatives.push_back( *withFunc );
+			} // if
 		} // for
 		candidates.clear();
@@ -737,22 +737,22 @@
 		indexer.lookupId( nameExpr->get_name(), declList );
 		PRINT( std::cerr << "nameExpr is " << nameExpr->get_name() << std::endl; )
-			for ( std::list< DeclarationWithType* >::iterator i = declList.begin(); i != declList.end(); ++i ) {
-				VariableExpr newExpr( *i, nameExpr->get_argName() );
-				alternatives.push_back( Alternative( newExpr.clone(), env, Cost() ) );
-				PRINT(
-					std::cerr << "decl is ";
-					(*i)->print( std::cerr );
-					std::cerr << std::endl;
-					std::cerr << "newExpr is ";
-					newExpr.print( std::cerr );
-					std::cerr << std::endl;
-					)
-					renameTypes( alternatives.back().expr );
-				if ( StructInstType *structInst = dynamic_cast< StructInstType* >( (*i)->get_type() ) ) {
-					addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), "" );
-				} else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( (*i)->get_type() ) ) {
-					addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), "" );
-				} // if
-			} // for
+		for ( std::list< DeclarationWithType* >::iterator i = declList.begin(); i != declList.end(); ++i ) {
+			VariableExpr newExpr( *i, nameExpr->get_argName() );
+			alternatives.push_back( Alternative( newExpr.clone(), env, Cost() ) );
+			PRINT(
+				std::cerr << "decl is ";
+				(*i)->print( std::cerr );
+				std::cerr << std::endl;
+				std::cerr << "newExpr is ";
+				newExpr.print( std::cerr );
+				std::cerr << std::endl;
+			)
+			renameTypes( alternatives.back().expr );
+			if ( StructInstType *structInst = dynamic_cast< StructInstType* >( (*i)->get_type() ) ) {
+				addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), "" );
+			} else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( (*i)->get_type() ) ) {
+				addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), "" );
+			} // if
+		} // for
 	}
 
@@ -794,11 +794,11 @@
 			argType->print( std::cout );
 			std::cout << std::endl;
-			)
-			if ( typesCompatibleIgnoreQualifiers( argType, function->get_parameters().front()->get_type(), indexer, env ) ) {
-				alternatives.push_back( Alternative( new AttrExpr( new VariableExpr( funcDecl ), argType->clone() ), env, Cost::zero ) );
-				for ( std::list< DeclarationWithType* >::iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) {
-					alternatives.back().expr->get_results().push_back( (*i)->get_type()->clone() );
-				} // for
-			} // if
+		)
+		if ( typesCompatibleIgnoreQualifiers( argType, function->get_parameters().front()->get_type(), indexer, env ) ) {
+			alternatives.push_back( Alternative( new AttrExpr( new VariableExpr( funcDecl ), argType->clone() ), env, Cost::zero ) );
+			for ( std::list< DeclarationWithType* >::iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) {
+				alternatives.back().expr->get_results().push_back( (*i)->get_type()->clone() );
+			} // for
+		} // if
 	}
 
Index: src/SymTab/Validate.cc
===================================================================
--- src/SymTab/Validate.cc	(revision 448f9b2ed27be828cc42a883f1d854f5d37cc613)
+++ src/SymTab/Validate.cc	(revision 49205cfb46b9e8b764eb9b51622c7760bedcae1b)
@@ -9,7 +9,7 @@
 // Author           : Richard C. Bilson
 // Created On       : Sun May 17 21:50:04 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 16:50:09 2015
-// Update Count     : 3
+// Last Modified By : Rob Schluntz
+// Last Modified On : Mon May 25 14:27:15 2015
+// Update Count     : 21
 //
 
@@ -560,4 +560,16 @@
 		for ( std::list< Declaration * >::const_iterator member = aggregateDecl->get_members().begin(); member != aggregateDecl->get_members().end(); ++member ) {
 			if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *member ) ) {
+				// query the type qualifiers of this field and skip assigning it if it is marked const. 
+				// If it is an array type, we need to strip off the array layers to find its qualifiers.
+				Type * type = dwt->get_type();
+				while ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) {
+					type = at->get_base();
+				}
+
+				if ( type->get_qualifiers().isConst ) {
+					// don't assign const members
+					continue;
+				}
+
 				if ( ArrayType *array = dynamic_cast< ArrayType * >( dwt->get_type() ) ) {
 					makeArrayAssignment( srcParam, dstParam, dwt, array, back_inserter( assignDecl->get_statements()->get_kids() ) );
Index: src/SynTree/Declaration.h
===================================================================
--- src/SynTree/Declaration.h	(revision 448f9b2ed27be828cc42a883f1d854f5d37cc613)
+++ src/SynTree/Declaration.h	(revision 49205cfb46b9e8b764eb9b51622c7760bedcae1b)
@@ -9,7 +9,7 @@
 // Author           : Richard C. Bilson
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu May 21 23:43:43 2015
-// Update Count     : 3
+// Last Modified By : Rob Schluntz
+// Last Modified On : Mon May 25 14:08:10 2015
+// Update Count     : 6
 //
 
@@ -123,6 +123,6 @@
 	CompoundStmt *get_statements() const { return statements; }
 	void set_statements( CompoundStmt *newValue ) { statements = newValue; }
-    bool get_isInline() const { return isInline; }
-//    void set_isInline( bool newValue ) { isInline = newValue; }
+	bool get_isInline() const { return isInline; }
+//	void set_isInline( bool newValue ) { isInline = newValue; }
 	std::list< std::string >& get_oldIdents() { return oldIdents; }
 	std::list< Declaration* >& get_oldDecls() { return oldDecls; }
