Index: src/ResolvExpr/CurrentObject.cc
===================================================================
--- src/ResolvExpr/CurrentObject.cc	(revision ea2759b7f6353252b6b90ed7fb4d0ff8cb161f94)
+++ src/ResolvExpr/CurrentObject.cc	(revision 04c78215345386ef39a45f6bb073dc726808d3b3)
@@ -671,30 +671,15 @@
 	};
 
-	/// Iterates array types
-	class ArrayIterator final : public MemberIterator {
+	/// Iterates over an indexed type:
+	class IndexIterator : public MemberIterator {
+	protected:
 		CodeLocation location;
-		const ArrayType * array = nullptr;
-		const Type * base = nullptr;
 		size_t index = 0;
 		size_t size = 0;
-		std::unique_ptr< MemberIterator > memberIter;
-
-		void setSize( const Expr * expr ) {
-			auto res = eval( expr );
-			if ( ! res.second ) {
-				SemanticError( location, toString( "Array designator must be a constant expression: ", expr ) );
-			}
-			size = res.first;
-		}
-
-	public:
-		ArrayIterator( const CodeLocation & loc, const ArrayType * at ) : location( loc ), array( at ), base( at->base ) {
-			PRINT( std::cerr << "Creating array iterator: " << at << std::endl; )
-			memberIter.reset( createMemberIterator( loc, base ) );
-			if ( at->isVarLen ) {
-				SemanticError( location, at, "VLA initialization does not support @=: " );
-			}
-			setSize( at->dimension );
-		}
+		std::unique_ptr<MemberIterator> memberIter;
+	public:
+		IndexIterator( const CodeLocation & loc, size_t size ) :
+			location( loc ), size( size )
+		{}
 
 		void setPosition( const Expr * expr ) {
@@ -705,5 +690,4 @@
 			auto arg = eval( expr );
 			index = arg.first;
-			return;
 
 			// if ( auto constExpr = dynamic_cast< const ConstantExpr * >( expr ) ) {
@@ -735,4 +719,29 @@
 
 		operator bool() const override { return index < size; }
+	};
+
+	/// Iterates over the members of array types:
+	class ArrayIterator final : public IndexIterator {
+		const ArrayType * array = nullptr;
+		const Type * base = nullptr;
+
+		size_t getSize( const Expr * expr ) {
+			auto res = eval( expr );
+			if ( !res.second ) {
+				SemanticError( location, toString( "Array designator must be a constant expression: ", expr ) );
+			}
+			return res.first;
+		}
+
+	public:
+		ArrayIterator( const CodeLocation & loc, const ArrayType * at ) :
+				IndexIterator( loc, getSize( at->dimension) ),
+				array( at ), base( at->base ) {
+			PRINT( std::cerr << "Creating array iterator: " << at << std::endl; )
+			memberIter.reset( createMemberIterator( loc, base ) );
+			if ( at->isVarLen ) {
+				SemanticError( location, at, "VLA initialization does not support @=: " );
+			}
+		}
 
 		ArrayIterator & bigStep() override {
@@ -873,5 +882,6 @@
 
 		const Type * getNext() final {
-			return ( memberIter && *memberIter ) ? memberIter->getType() : nullptr;
+			bool hasMember = memberIter && *memberIter;
+			return hasMember ? memberIter->getType() : nullptr;
 		}
 
@@ -938,10 +948,6 @@
 
 	/// Iterates across the positions in a tuple:
-	class TupleIterator final : public MemberIterator {
-		CodeLocation location;
+	class TupleIterator final : public IndexIterator {
 		ast::TupleType const * const tuple;
-		size_t index = 0;
-		size_t size = 0;
-		std::unique_ptr<MemberIterator> sub_iter;
 
 		const ast::Type * typeAtIndex() const {
@@ -952,34 +958,12 @@
 	public:
 		TupleIterator( const CodeLocation & loc, const TupleType * type )
-		: location( loc ), tuple( type ), size( type->size() ) {
+		: IndexIterator( loc, type->size() ), tuple( type ) {
 			PRINT( std::cerr << "Creating tuple iterator: " << type << std::endl; )
-			sub_iter.reset( createMemberIterator( loc, typeAtIndex() ) );
-		}
-
-		void setPosition( const ast::Expr * expr ) {
-			auto arg = eval( expr );
-			index = arg.first;
-		}
-
-		void setPosition(
-				std::deque< ptr< Expr > >::const_iterator begin,
-				std::deque< ptr< Expr > >::const_iterator end ) {
-			if ( begin == end ) return;
-
-			setPosition( *begin );
-			sub_iter->setPosition( ++begin, end );
-		}
-
-		std::deque< InitAlternative > operator*() const override {
-			return first();
-		}
-
-		operator bool() const override {
-			return index < size;
+			memberIter.reset( createMemberIterator( loc, typeAtIndex() ) );
 		}
 
 		TupleIterator & bigStep() override {
 			++index;
-			sub_iter.reset( index < size ?
+			memberIter.reset( index < size ?
 				createMemberIterator( location, typeAtIndex() ) : nullptr );
 			return *this;
@@ -987,8 +971,8 @@
 
 		TupleIterator & smallStep() override {
-			if ( sub_iter ) {
-				PRINT( std::cerr << "has member iter: " << *sub_iter << std::endl; )
-				sub_iter->smallStep();
-				if ( !sub_iter ) {
+			if ( memberIter ) {
+				PRINT( std::cerr << "has member iter: " << *memberIter << std::endl; )
+				memberIter->smallStep();
+				if ( !memberIter ) {
 					PRINT( std::cerr << "has valid member iter" << std::endl; )
 					return *this;
@@ -1003,11 +987,12 @@
 
 		const ast::Type * getNext() override {
-			return ( sub_iter && *sub_iter ) ? sub_iter->getType() : nullptr;
+			bool hasMember = memberIter && *memberIter;
+			return hasMember ? memberIter->getType() : nullptr;
 		}
 
 		std::deque< InitAlternative > first() const override {
 			PRINT( std::cerr << "first in TupleIterator (" << index << "/" << size << ")" << std::endl; )
-			if ( sub_iter && *sub_iter ) {
-				std::deque< InitAlternative > ret = sub_iter->first();
+			if ( memberIter && *memberIter ) {
+				std::deque< InitAlternative > ret = memberIter->first();
 				for ( InitAlternative & alt : ret ) {
 					alt.designation.get_and_mutate()->designators.emplace_front(
