Index: src/InitTweak/FixInit.cc
===================================================================
--- src/InitTweak/FixInit.cc	(revision 2c9ebabd500b086aeb45d01caed3a928fad5b3c2)
+++ src/InitTweak/FixInit.cc	(revision 130991051943d0cf7e8992a92d23eb0d900bec04)
@@ -896,7 +896,10 @@
 			Parent::visit( compoundStmt );
 
-			// add destructors for the current scope that we're exiting
+			// add destructors for the current scope that we're exiting, unless the last statement is a return, which
+			// causes unreachable code warnings
 			std::list< Statement * > & statements = compoundStmt->get_kids();
-			insertDtors( reverseDeclOrder.front().begin(), reverseDeclOrder.front().end(), back_inserter( statements ) );
+			if ( ! statements.empty() && ! dynamic_cast< ReturnStmt * >( statements.back() ) ) {
+				insertDtors( reverseDeclOrder.front().begin(), reverseDeclOrder.front().end(), back_inserter( statements ) );
+			}
 			reverseDeclOrder.pop_front();
 		}
Index: src/SymTab/Validate.cc
===================================================================
--- src/SymTab/Validate.cc	(revision 2c9ebabd500b086aeb45d01caed3a928fad5b3c2)
+++ src/SymTab/Validate.cc	(revision 130991051943d0cf7e8992a92d23eb0d900bec04)
@@ -208,4 +208,12 @@
 	};
 
+	/// ensure that generic types have the correct number of type arguments
+	class ValidateGenericParameters : public Visitor {
+	public:
+		typedef Visitor Parent;
+		virtual void visit( StructInstType * inst ) final override;
+		virtual void visit( UnionInstType * inst ) final override;
+	};
+
 	class ArrayLength : public Visitor {
 	public:
@@ -235,9 +243,11 @@
 		Pass3 pass3( 0 );
 		CompoundLiteral compoundliteral;
-
-		HoistStruct::hoistStruct( translationUnit );
+		ValidateGenericParameters genericParams;
+
 		EliminateTypedef::eliminateTypedef( translationUnit );
+		HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
 		ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
 		acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
+		acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
 		acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist
 		VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
@@ -829,4 +839,24 @@
 	}
 
+	template< typename Aggr >
+	void validateGeneric( Aggr * inst ) {
+		std::list< TypeDecl * > * params = inst->get_baseParameters();
+		if ( params != NULL ) {
+			std::list< Expression * > & args = inst->get_parameters();
+			if ( args.size() < params->size() ) throw SemanticError( "Too few type arguments in generic type ", inst );
+			if ( args.size() > params->size() ) throw SemanticError( "Too many type arguments in generic type ", inst );
+		}
+	}
+
+	void ValidateGenericParameters::visit( StructInstType * inst ) {
+		validateGeneric( inst );
+		Parent::visit( inst );
+	}
+
+	void ValidateGenericParameters::visit( UnionInstType * inst ) {
+		validateGeneric( inst );
+		Parent::visit( inst );
+	}
+
 	DeclarationWithType * CompoundLiteral::mutate( ObjectDecl *objectDecl ) {
 		storageClasses = objectDecl->get_storageClasses();
Index: src/libcfa/gmp
===================================================================
--- src/libcfa/gmp	(revision 2c9ebabd500b086aeb45d01caed3a928fad5b3c2)
+++ src/libcfa/gmp	(revision 130991051943d0cf7e8992a92d23eb0d900bec04)
@@ -10,6 +10,6 @@
 // Created On       : Tue Apr 19 08:43:43 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sun May 14 23:47:36 2017
-// Update Count     : 9
+// Last Modified On : Mon May 22 08:32:39 2017
+// Update Count     : 13
 // 
 
@@ -35,5 +35,5 @@
 Int ?=?( Int * lhs, long int rhs ) { mpz_set_si( lhs->mpz, rhs ); return *lhs; }
 Int ?=?( Int * lhs, unsigned long int rhs ) { mpz_set_ui( lhs->mpz, rhs ); return *lhs; }
-//Int ?=?( Int * lhs, const char * rhs ) { if ( mpq_set_str( lhs->mpz, rhs, 0 ) ) abort(); return *lhs; }
+Int ?=?( Int * lhs, const char * rhs ) { if ( mpz_set_str( lhs->mpz, rhs, 0 ) ) { printf( "invalid string conversion\n" ); abort(); } return *lhs; }
 
 char ?=?( char * lhs, Int rhs ) { char val = mpz_get_si( rhs.mpz ); *lhs = val; return val; }
Index: src/tests/.expect/64/gmp.txt
===================================================================
--- src/tests/.expect/64/gmp.txt	(revision 2c9ebabd500b086aeb45d01caed3a928fad5b3c2)
+++ src/tests/.expect/64/gmp.txt	(revision 130991051943d0cf7e8992a92d23eb0d900bec04)
@@ -4,4 +4,5 @@
 conversions
 y:97
+y:12345678901234567890123456789
 y:3
 y:-3
@@ -24,4 +25,5 @@
 z:150000000000000000000
 z:16666666666666666666
+16666666666666666666, 2 16666666666666666666, 2
 x:16666666666666666666 y:2
 
Index: src/tests/gmp.c
===================================================================
--- src/tests/gmp.c	(revision 2c9ebabd500b086aeb45d01caed3a928fad5b3c2)
+++ src/tests/gmp.c	(revision 130991051943d0cf7e8992a92d23eb0d900bec04)
@@ -10,11 +10,11 @@
 // Created On       : Tue Apr 19 08:55:51 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sun May 14 14:46:50 2017
-// Update Count     : 530
+// Last Modified On : Mon May 22 09:05:09 2017
+// Update Count     : 538
 // 
 
 #include <gmp>
 
-int main() {
+int main( void ) {
 	sout | "constructors" | endl;
 	short int si = 3;
@@ -25,4 +25,6 @@
 	sout | "conversions" | endl;
 	y = 'a';
+	sout | "y:" | y | endl;
+	y = "12345678901234567890123456789";
 	sout | "y:" | y | endl;
 	y = si;
@@ -62,7 +64,7 @@
 	z = x / 3;
 	sout | "z:" | z | endl;
+	sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;
 	[ x, y ] = div( x, 3 );
 	sout | "x:" | x | "y:" | y | endl;
-//	sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;
 
 	sout | endl;
@@ -72,7 +74,7 @@
 	fn = (Int){0}; fn1 = fn;							// 1st case
 	sout | (int)0 | fn | endl;
-	fn = (Int){1}; fn2 = fn1; fn1 = fn;					// 2nd case
+	fn = 1; fn2 = fn1; fn1 = fn;						// 2nd case
 	sout | 1 | fn | endl;
-	for ( int i = 2; i <= 200; i += 1 ) {
+	for ( unsigned int i = 2; i <= 200; i += 1 ) {
 		fn = fn1 + fn2; fn2 = fn1; fn1 = fn;			// general case
 		sout | i | fn | endl;
@@ -83,7 +85,7 @@
 	sout | "Factorial Numbers" | endl;
 	Int fact;
-	fact = (Int){1};									// 1st case
+	fact = 1;											// 1st case
 	sout | (int)0 | fact | endl;
-	for ( int i = 1; i <= 40; i += 1 ) {
+	for ( unsigned int i = 1; i <= 40; i += 1 ) {
 		fact = fact * i;								// general case
 		sout | i | fact | endl;
