Index: src/SymTab/Validate.cc
===================================================================
--- src/SymTab/Validate.cc	(revision 062e8df6b7bfeda5076f3a78100f203e2752fdf8)
+++ src/SymTab/Validate.cc	(revision aeec6b776d14e45c7d0eae9f5b5c1a1a6ab38bea)
@@ -200,4 +200,5 @@
 		void premutate( UnionDecl * unionDecl );
 		void premutate( EnumDecl * enumDecl );
+		void premutate( TraitDecl * );
 
 		void premutate( FunctionType * ftype );
@@ -211,5 +212,5 @@
 		typedef std::unique_ptr<TypedefDecl> TypedefDeclPtr;
 		typedef ScopedMap< std::string, std::pair< TypedefDeclPtr, int > > TypedefMap;
-		typedef std::map< std::string, TypeDecl * > TypeDeclMap; // xxx - convert to ScopedMap
+		typedef ScopedMap< std::string, TypeDecl * > TypeDeclMap;
 		TypedefMap typedefNames;
 		TypeDeclMap typedeclNames;
@@ -981,13 +982,15 @@
 		} // if
 
-		typedeclNames[ typeDecl->name ] = typeDecl;
+		typedeclNames.insert( typeDecl->name, typeDecl );
 	}
 
 	void ReplaceTypedef::premutate( FunctionDecl * ) {
 		GuardScope( typedefNames );
+		GuardScope( typedeclNames );
 	}
 
 	void ReplaceTypedef::premutate( ObjectDecl * ) {
 		GuardScope( typedefNames );
+		GuardScope( typedeclNames );
 	}
 
@@ -1006,8 +1009,10 @@
 	void ReplaceTypedef::premutate( CastExpr * ) {
 		GuardScope( typedefNames );
+		GuardScope( typedeclNames );
 	}
 
 	void ReplaceTypedef::premutate( CompoundStmt * ) {
 		GuardScope( typedefNames );
+		GuardScope( typedeclNames );
 		scopeLevel += 1;
 		GuardAction( [this](){ scopeLevel -= 1; } );
@@ -1042,4 +1047,5 @@
 
 		GuardScope( typedefNames );
+		GuardScope( typedeclNames );
 		mutateAll( aggr->parameters, *visitor );
 
@@ -1080,4 +1086,9 @@
 		GuardValue( inFunctionType );
 		inFunctionType = true;
+	}
+
+	void ReplaceTypedef::premutate( TraitDecl * ) {
+		GuardScope( typedefNames );
+		GuardScope( typedeclNames);
 	}
 
