Index: src/ResolvExpr/Resolver.cc
===================================================================
--- src/ResolvExpr/Resolver.cc	(revision 51fcdbc7bbe9ee66b4aed138d4e44171115b6e20)
+++ src/ResolvExpr/Resolver.cc	(revision 2b79a705ea7fc9439579f72a887d080e6387f0d5)
@@ -30,5 +30,4 @@
 #include "RenameVars.h"                  // for RenameVars, global_renamer
 #include "ResolvExpr/TypeEnvironment.h"  // for TypeEnvironment
-#include "ResolveTypeof.h"               // for resolveTypeof
 #include "Resolver.h"
 #include "SymTab/Autogen.h"              // for SizeType
@@ -57,5 +56,4 @@
 		void postvisit( FunctionDecl *functionDecl );
 		void previsit( ObjectDecl *objectDecll );
-		void previsit( TypeDecl *typeDecl );
 		void previsit( EnumDecl * enumDecl );
 		void previsit( StaticAssertDecl * assertDecl );
@@ -303,7 +301,4 @@
 
 	void Resolver::previsit( ObjectDecl *objectDecl ) {
-		Type *new_type = resolveTypeof( objectDecl->get_type(), indexer );
-		new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type
-		objectDecl->set_type( new_type );
 		// To handle initialization of routine pointers, e.g., int (*fp)(int) = foo(), means that class-variable
 		// initContext is changed multiple time because the LHS is analysed twice. The second analysis changes
@@ -335,11 +330,4 @@
 	}
 
-	void Resolver::previsit( TypeDecl *typeDecl ) {
-		if ( typeDecl->get_base() ) {
-			Type *new_type = resolveTypeof( typeDecl->get_base(), indexer );
-			typeDecl->set_base( new_type );
-		} // if
-	}
-
 	void Resolver::previsit( FunctionDecl *functionDecl ) {
 #if 0
@@ -348,6 +336,4 @@
 		std::cerr << std::endl;
 #endif
-		Type *new_type = resolveTypeof( functionDecl->type, indexer );
-		functionDecl->set_type( new_type );
 		GuardValue( functionReturn );
 		functionReturn = ResolvExpr::extractResultType( functionDecl->type );
Index: src/SymTab/Validate.cc
===================================================================
--- src/SymTab/Validate.cc	(revision 51fcdbc7bbe9ee66b4aed138d4e44171115b6e20)
+++ src/SymTab/Validate.cc	(revision 2b79a705ea7fc9439579f72a887d080e6387f0d5)
@@ -62,4 +62,5 @@
 #include "ResolvExpr/typeops.h"        // for typesCompatible
 #include "ResolvExpr/Resolver.h"       // for findSingleExpression
+#include "ResolvExpr/ResolveTypeof.h"  // for resolveTypeof
 #include "SymTab/Autogen.h"            // for SizeType
 #include "SynTree/Attribute.h"         // for noAttributes, Attribute
@@ -247,4 +248,13 @@
 		void previsit( StructInstType * inst );
 		void previsit( UnionInstType * inst );
+	};
+
+	struct FixObjectType : public WithIndexer {
+		/// resolves typeof type in object, function, and type declarations
+		static void fix( std::list< Declaration * > & translationUnit );
+
+		void previsit( ObjectDecl * );
+		void previsit( FunctionDecl * );
+		void previsit( TypeDecl * );
 	};
 
@@ -312,4 +322,5 @@
 		Concurrency::implementThreadStarter( translationUnit );
 		mutateAll( translationUnit, compoundliteral );
+		FixObjectType::fix( translationUnit );
 		ArrayLength::computeLength( translationUnit );
 		acceptAll( translationUnit, finder ); // xxx - remove this pass soon
@@ -1238,4 +1249,29 @@
 	}
 
+	void FixObjectType::fix( std::list< Declaration * > & translationUnit ) {
+		PassVisitor<FixObjectType> fixer;
+		acceptAll( translationUnit, fixer );
+	}
+
+	void FixObjectType::previsit( ObjectDecl * objDecl ) {
+		Type *new_type = ResolvExpr::resolveTypeof( objDecl->get_type(), indexer );
+		new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type
+		objDecl->set_type( new_type );
+	}
+
+	void FixObjectType::previsit( FunctionDecl * funcDecl ) {
+		Type *new_type = ResolvExpr::resolveTypeof( funcDecl->type, indexer );
+		new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type
+		funcDecl->set_type( new_type );
+	}
+
+	void FixObjectType::previsit( TypeDecl *typeDecl ) {
+		if ( typeDecl->get_base() ) {
+			Type *new_type = ResolvExpr::resolveTypeof( typeDecl->get_base(), indexer );
+			new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type
+			typeDecl->set_base( new_type );
+		} // if
+	}
+
 	void ArrayLength::computeLength( std::list< Declaration * > & translationUnit ) {
 		PassVisitor<ArrayLength> len;
Index: src/tests/.expect/gccExtensions.x64.txt
===================================================================
--- src/tests/.expect/gccExtensions.x64.txt	(revision 51fcdbc7bbe9ee66b4aed138d4e44171115b6e20)
+++ src/tests/.expect/gccExtensions.x64.txt	(revision 2b79a705ea7fc9439579f72a887d080e6387f0d5)
@@ -29,6 +29,6 @@
     volatile signed int __v1__Vi_2;
     volatile signed int __v2__Vi_2;
-    signed int __t1___2;
-    signed int __t2___2;
+    signed int __t1__i_2;
+    signed int __t2__i_2;
     __extension__ const signed int __ex__Ci_2;
     struct S {
Index: src/tests/.expect/gccExtensions.x86.txt
===================================================================
--- src/tests/.expect/gccExtensions.x86.txt	(revision 51fcdbc7bbe9ee66b4aed138d4e44171115b6e20)
+++ src/tests/.expect/gccExtensions.x86.txt	(revision 2b79a705ea7fc9439579f72a887d080e6387f0d5)
@@ -29,6 +29,6 @@
     volatile signed int __v1__Vi_2;
     volatile signed int __v2__Vi_2;
-    signed int __t1___2;
-    signed int __t2___2;
+    signed int __t1__i_2;
+    signed int __t2__i_2;
     __extension__ const signed int __ex__Ci_2;
     struct S {
