Index: src/Parser/DeclarationNode.cc
===================================================================
--- src/Parser/DeclarationNode.cc	(revision e5d5272eaf163f7cdda41557fe573b774e03451a)
+++ src/Parser/DeclarationNode.cc	(revision a1c9ddd9a661829236d83dd35710833fcf6cf8b1)
@@ -10,6 +10,6 @@
 // Created On       : Sat May 16 12:34:05 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jun  6 15:57:50 2018
-// Update Count     : 1076
+// Last Modified On : Thu Jun  7 12:08:55 2018
+// Update Count     : 1079
 //
 
@@ -545,7 +545,5 @@
 					type->aggregate.params->appendList( q->type->forall ); // augment forall qualifier
 				} else {								// not polymorphic
-					type->aggregate.params = q->type->forall; // make polymorphic type
-					// change implicit typedef from TYPEDEFname to TYPEGENname
-					typedefTable.changeKind( *type->aggregate.name, TYPEGENname );
+					type->aggregate.params = q->type->forall; // set forall qualifier
 				} // if
 			} else {									// not polymorphic
Index: src/Parser/TypedefTable.cc
===================================================================
--- src/Parser/TypedefTable.cc	(revision e5d5272eaf163f7cdda41557fe573b774e03451a)
+++ src/Parser/TypedefTable.cc	(revision a1c9ddd9a661829236d83dd35710833fcf6cf8b1)
@@ -10,6 +10,6 @@
 // Created On       : Sat May 16 15:20:13 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Jun  1 16:54:18 2018
-// Update Count     : 155
+// Last Modified On : Thu Jun  7 13:17:56 2018
+// Update Count     : 192
 //
 
@@ -17,7 +17,7 @@
 #include "TypedefTable.h"
 #include <cassert>										// for assert
+#include <iostream>
 
 #if 0
-#include <iostream>
 #define debugPrint( code ) code
 #else
@@ -27,7 +27,21 @@
 using namespace std;									// string, iostream
 
+debugPrint(
+static const char *kindName( int kind ) {
+	switch ( kind ) {
+	  case IDENTIFIER: return "identifier";
+	  case TYPEDEFname: return "typedef";
+	  case TYPEGENname: return "typegen";
+	  default:
+		cerr << "Error: cfa-cpp internal error, invalid kind of identifier" << endl;
+		abort();
+	} // switch
+} // kindName
+)
+
 TypedefTable::~TypedefTable() {
 	if ( ! SemanticErrorThrow && kindTable.currentScope() != 0 ) {
-		std::cerr << "scope failure " << kindTable.currentScope() << endl;
+		cerr << "Error: cfa-cpp internal error, scope failure " << kindTable.currentScope() << endl;
+		abort();
 	} // if
 } // TypedefTable::~TypedefTable
@@ -44,29 +58,31 @@
 } // TypedefTable::isKind
 
-void TypedefTable::changeKind( const string & identifier, int kind ) {
-	KindTable::iterator posn = kindTable.find( identifier );
-	if ( posn != kindTable.end() ) posn->second = kind;	// exists => update
-} // TypedefTable::changeKind
-
 // SKULLDUGGERY: Generate a typedef for the aggregate name so the aggregate does not have to be qualified by
 // "struct". Only generate the typedef, if the name is not in use. The typedef is implicitly (silently) removed if the
 // name is explicitly used.
-void TypedefTable::makeTypedef( const string & name ) {
+void TypedefTable::makeTypedef( const string & name, int kind ) {
+//    Check for existence is necessary to handle:
+//        struct Fred {};
+//        void Fred();
+//        void fred() {
+//           struct Fred act; // do not add as type in this scope
+//           Fred();
+//        }
 	if ( ! typedefTable.exists( name ) ) {
-		typedefTable.addToEnclosingScope( name, TYPEDEFname, "MTD" );
+		typedefTable.addToEnclosingScope( name, kind, "MTD" );
 	} // if
 } // TypedefTable::makeTypedef
 
-void TypedefTable::addToScope( const std::string & identifier, int kind, const char * locn __attribute__((unused)) ) {
+void TypedefTable::addToScope( const string & identifier, int kind, const char * locn __attribute__((unused)) ) {
 	auto scope = kindTable.currentScope();
-	debugPrint( cerr << "Adding at " << locn << " " << identifier << " as kind " << kind << " scope " << scope << endl );
+	debugPrint( cerr << "Adding current at " << locn << " " << identifier << " as " << kindName( kind ) << " scope " << scope << endl );
 	auto ret = kindTable.insertAt( scope, identifier, kind );
 	if ( ! ret.second ) ret.first->second = kind;		// exists => update
 } // TypedefTable::addToScope
 
-void TypedefTable::addToEnclosingScope( const std::string & identifier, int kind, const char * locn __attribute__((unused)) ) {
+void TypedefTable::addToEnclosingScope( const string & identifier, int kind, const char * locn __attribute__((unused)) ) {
 	assert( kindTable.currentScope() >= 1 );
 	auto scope = kindTable.currentScope() - 1;
-	debugPrint( cerr << "Adding+1 at " << locn << " " << identifier << " as kind " << kind << " scope " << scope << endl );
+	debugPrint( cerr << "Adding enclosing at " << locn << " " << identifier << " as " << kindName( kind ) << " scope " << scope << endl );
 	auto ret = kindTable.insertAt( scope, identifier, kind );
 	if ( ! ret.second ) ret.first->second = kind;		// exists => update
@@ -93,5 +109,5 @@
 			debugPrint( cerr << endl << "[" << scope << "]" );
 		} // while
-		debugPrint( cerr << " " << (*i).first << ":" << (*i).second );
+		debugPrint( cerr << " " << (*i).first << ":" << kindName( (*i).second ) );
 	} // for
 	while ( scope > 0 ) {
Index: src/Parser/TypedefTable.h
===================================================================
--- src/Parser/TypedefTable.h	(revision e5d5272eaf163f7cdda41557fe573b774e03451a)
+++ src/Parser/TypedefTable.h	(revision a1c9ddd9a661829236d83dd35710833fcf6cf8b1)
@@ -10,6 +10,6 @@
 // Created On       : Sat May 16 15:24:36 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu May 31 23:23:47 2018
-// Update Count     : 83
+// Last Modified On : Thu Jun  7 12:10:17 2018
+// Update Count     : 85
 //
 
@@ -30,6 +30,5 @@
 	bool exists( const std::string & identifier );
 	int isKind( const std::string & identifier ) const;
-	void changeKind( const std::string & identifier, int kind );
-	void makeTypedef( const std::string & name );
+	void makeTypedef( const std::string & name, int kind = TYPEDEFname );
 	void addToScope( const std::string & identifier, int kind, const char * );
 	void addToEnclosingScope( const std::string & identifier, int kind, const char * );
Index: src/Parser/parser.yy
===================================================================
--- src/Parser/parser.yy	(revision e5d5272eaf163f7cdda41557fe573b774e03451a)
+++ src/Parser/parser.yy	(revision a1c9ddd9a661829236d83dd35710833fcf6cf8b1)
@@ -10,6 +10,6 @@
 // Created On       : Sat Sep  1 20:22:55 2001
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jun  6 14:53:38 2018
-// Update Count     : 3522
+// Last Modified On : Thu Jun  7 10:07:12 2018
+// Update Count     : 3527
 //
 
@@ -1826,6 +1826,6 @@
 	| aggregate_key attribute_list_opt no_attr_identifier
 		{
-			typedefTable.makeTypedef( *$3 );			// create typedef
-			if ( forall ) typedefTable.changeKind( *$3, TYPEGENname ); // possibly update
+			typedefTable.makeTypedef( *$3, forall ? TYPEGENname : TYPEDEFname ); // create typedef
+			//if ( forall ) typedefTable.changeKind( *$3, TYPEGENname ); // possibly update
 			forall = false;								// reset
 		}
@@ -1834,6 +1834,6 @@
 	| aggregate_key attribute_list_opt type_name
 		{
-			typedefTable.makeTypedef( *$3->type->symbolic.name ); // create typedef
-			if ( forall ) typedefTable.changeKind( *$3->type->symbolic.name, TYPEGENname ); // possibly update
+			typedefTable.makeTypedef( *$3->type->symbolic.name, forall ? TYPEGENname : TYPEDEFname ); // create typedef
+			//if ( forall ) typedefTable.changeKind( *$3->type->symbolic.name, TYPEGENname ); // possibly update
 			forall = false;								// reset
 		}
@@ -1848,6 +1848,6 @@
 	aggregate_key attribute_list_opt no_attr_identifier
 		{
-			typedefTable.makeTypedef( *$3 );
-			if ( forall ) typedefTable.changeKind( *$3, TYPEGENname ); // possibly update
+			typedefTable.makeTypedef( *$3, forall ? TYPEGENname : TYPEDEFname );
+			//if ( forall ) typedefTable.changeKind( *$3, TYPEGENname ); // possibly update
 			forall = false;								// reset
 			$$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
@@ -3264,4 +3264,5 @@
 
 %%
+
 // ----end of grammar----
 
