Index: src/InitTweak/GenInit.cc
===================================================================
--- src/InitTweak/GenInit.cc	(revision 40e636a3e71c878c7a10447ffe19e38fab7a8677)
+++ src/InitTweak/GenInit.cc	(revision 6cf27a070551542d34340180263c714585975c85)
@@ -61,6 +61,4 @@
 		static void generateCtorDtor( std::list< Declaration * > &translationUnit );
 
-		CtorDtor() : inFunction( false ) {}
-
 		virtual DeclarationWithType * mutate( ObjectDecl * );
 		virtual DeclarationWithType * mutate( FunctionDecl *functionDecl );
@@ -77,5 +75,4 @@
 
 	  protected:
-		bool inFunction;
 	};
 
@@ -216,53 +213,55 @@
 
 	DeclarationWithType * CtorDtor::mutate( ObjectDecl * objDecl ) {
-		// hands off if designated or if @=
+		// hands off if designated, if @=, or if extern
 		if ( tryConstruct( objDecl ) ) {
-			if ( inFunction ) {
-				if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) {
-					// call into makeArrayFunction from validate.cc to generate calls to ctor/dtor for each element of array
-					// TODO: walk initializers and generate appropriate ctor if element has initializer.
-					// Initializer could be nested (depends on the depth of the array type on the object)
-
-					std::list< Expression * > args = makeInitList( objDecl->get_init() );
-					if ( args.empty() ) {
-						std::list< Statement * > ctor;
-						std::list< Statement * > dtor;
-
-						SymTab::genImplicitCall( NULL, new VariableExpr( objDecl ), "?{}", back_inserter( ctor ), objDecl );
-						SymTab::genImplicitCall( NULL, new VariableExpr( objDecl ), "^?{}", front_inserter( dtor ), objDecl, false );
-
-						// Currently genArrayCall produces a single Statement - a CompoundStmt
-						// which  wraps everything that needs to happen. As such, it's technically
-						// possible to use a Statement ** in the above calls, but this is inherently
-						// unsafe, so instead we take the slightly less efficient route, but will be
-						// immediately informed if somehow the above assumption is broken. In this case,
-						// we could always wrap the list of statements at this point with a CompoundStmt,
-						// but it seems reasonable at the moment for this to be done by genArrayCall
-						// itself
-						assert( ctor.size() == 1 && dynamic_cast< ImplicitCtorDtorStmt * >( ctor.front() ) );
-						assert( dtor.size() == 1 && dynamic_cast< ImplicitCtorDtorStmt * >( dtor.front() ) );
+			if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) {
+				// call into makeArrayFunction from validate.cc to generate calls to ctor/dtor for each element of array
+				// TODO: walk initializers and generate appropriate ctor if element has initializer.
+				// Initializer could be nested (depends on the depth of the array type on the object)
+
+				std::list< Expression * > args = makeInitList( objDecl->get_init() );
+				if ( args.empty() ) {
+					std::list< Statement * > ctor;
+					std::list< Statement * > dtor;
+
+					SymTab::genImplicitCall( NULL, new VariableExpr( objDecl ), "?{}", back_inserter( ctor ), objDecl );
+					SymTab::genImplicitCall( NULL, new VariableExpr( objDecl ), "^?{}", front_inserter( dtor ), objDecl, false );
+
+					// Currently genImplicitCall produces a single Statement - a CompoundStmt
+					// which  wraps everything that needs to happen. As such, it's technically
+					// possible to use a Statement ** in the above calls, but this is inherently
+					// unsafe, so instead we take the slightly less efficient route, but will be
+					// immediately informed if somehow the above assumption is broken. In this case,
+					// we could always wrap the list of statements at this point with a CompoundStmt,
+					// but it seems reasonable at the moment for this to be done by genImplicitCall
+					// itself. It is possible that genImplicitCall produces no statements (e.g. if
+					// an array type does not have a dimension). In this case, it's fine to ignore
+					// the object for the purposes of construction.
+					assert( ctor.size() == dtor.size() && ctor.size() <= 1 );
+					if ( ctor.size() == 1 ) {
+						assert( dynamic_cast< ImplicitCtorDtorStmt * > ( ctor.front() ) && dynamic_cast< ImplicitCtorDtorStmt * > ( dtor.front() ) );
 						objDecl->set_init( new ConstructorInit( ctor.front(), dtor.front(), objDecl->get_init() ) );
-					} else {
-						// array came with an initializer list: initialize each element
-						// may have more initializers than elements in the array - need to check at each index that
-						// we haven't exceeded size. This requires precomputing the size because it might be a side-effecting
-						// computation.
-						// may have fewer initializers than elements in the array - need to default construct
-						// remaining elements.
-						// might be able to merge this with the case above.
-
 					}
 				} else {
-					// it's sufficient to attempt to call the ctor/dtor for the given object and its initializer
-					Expression * ctor = makeCtorDtorExpr( "?{}", objDecl, makeInitList( objDecl->get_init() ) );
-					Expression * dtor = makeCtorDtorExpr( "^?{}", objDecl, std::list< Expression * >() );
-
-					// need to remember init expression, in case no ctors exist
-					// if ctor does exist, want to use ctor expression instead of init
-					// push this decision to the resolver
-					ExprStmt * ctorStmt = new ExprStmt( noLabels, ctor );
-					ExprStmt * dtorStmt = new ExprStmt( noLabels, dtor );
-					objDecl->set_init( new ConstructorInit( new ImplicitCtorDtorStmt( ctorStmt ), new ImplicitCtorDtorStmt( dtorStmt ), objDecl->get_init() ) );
+					// array came with an initializer list: initialize each element
+					// may have more initializers than elements in the array - need to check at each index that
+					// we haven't exceeded size. This requires precomputing the size because it might be a side-effecting
+					// computation.
+					// may have fewer initializers than elements in the array - need to default construct
+					// remaining elements.
+					// might be able to merge this with the case above.
+
 				}
+			} else {
+				// it's sufficient to attempt to call the ctor/dtor for the given object and its initializer
+				Expression * ctor = makeCtorDtorExpr( "?{}", objDecl, makeInitList( objDecl->get_init() ) );
+				Expression * dtor = makeCtorDtorExpr( "^?{}", objDecl, std::list< Expression * >() );
+
+				// need to remember init expression, in case no ctors exist
+				// if ctor does exist, want to use ctor expression instead of init
+				// push this decision to the resolver
+				ExprStmt * ctorStmt = new ExprStmt( noLabels, ctor );
+				ExprStmt * dtorStmt = new ExprStmt( noLabels, dtor );
+				objDecl->set_init( new ConstructorInit( new ImplicitCtorDtorStmt( ctorStmt ), new ImplicitCtorDtorStmt( dtorStmt ), objDecl->get_init() ) );
 			}
 		}
@@ -272,9 +271,6 @@
 	DeclarationWithType * CtorDtor::mutate( FunctionDecl *functionDecl ) {
 		// parameters should not be constructed and destructed, so don't mutate FunctionType
-		bool oldInFunc = inFunction;
 		mutateAll( functionDecl->get_oldDecls(), *this );
-		inFunction = true;
 		functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) );
-		inFunction = oldInFunc;
 		return functionDecl;
 	}
