Index: src/Parser/DeclarationNode.cc
===================================================================
--- src/Parser/DeclarationNode.cc	(revision 8f6f47d7dda0117750908df7f55ff6a7f7349277)
+++ src/Parser/DeclarationNode.cc	(revision f04a8b8185a659aca192dfb26ef42f86ae57b800)
@@ -10,6 +10,6 @@
 // Created On       : Sat May 16 12:34:05 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Aug 29 15:55:12 2016
-// Update Count     : 311
+// Last Modified On : Mon Aug 29 22:30:56 2016
+// Update Count     : 327
 //
 
@@ -42,4 +42,30 @@
 
 extern LinkageSpec::Spec linkage;						// defined in parser.yy
+
+DeclarationNode::DeclarationNode()
+		: type( 0 )
+		, storageClass( NoStorageClass )
+		, isInline( false )
+		, isNoreturn( false )
+		, bitfieldWidth( 0 )
+		, initializer( 0 )
+		, hasEllipsis( false )
+		, linkage( ::linkage )
+		, extension( false )
+		, error() {
+	attr.expr = nullptr;
+	attr.type = nullptr;
+
+	variable.tyClass = DeclarationNode::Type;
+	variable.assertions = nullptr;
+}
+
+DeclarationNode::~DeclarationNode() {
+	delete attr.expr;
+	delete attr.type;
+	delete type;
+	delete bitfieldWidth;
+	delete initializer;
+}
 
 DeclarationNode *DeclarationNode::clone() const {
@@ -55,25 +81,13 @@
 	newnode->set_next( maybeClone( get_next() ) );
 	newnode->linkage = linkage;
+
+	newnode->variable.assertions = maybeClone( variable.assertions );
+	newnode->variable.name = variable.name;
+	newnode->variable.tyClass = variable.tyClass;
+
+	newnode->attr.expr = maybeClone( attr.expr );
+	newnode->attr.type = maybeClone( attr.type );
 	return newnode;
 } // DeclarationNode::clone
-
-DeclarationNode::DeclarationNode()
-	: type( 0 )
-	, storageClass( NoStorageClass )
-	, isInline( false )
-	, isNoreturn( false )
-	, bitfieldWidth( 0 )
-	, initializer( 0 )
-	, hasEllipsis( false )
-	, linkage( ::linkage )
-	, extension( false )
-	, error() {
-}
-
-DeclarationNode::~DeclarationNode() {
-	delete type;
-	delete bitfieldWidth;
-	delete initializer;
-}
 
 bool DeclarationNode::get_hasEllipsis() const {
@@ -248,6 +262,6 @@
 	newnode->name = assign_strptr( name );
 	newnode->type = new TypeData( TypeData::Variable );
-	newnode->type->variable.tyClass = tc;
-	newnode->type->variable.name = newnode->name;
+	newnode->variable.tyClass = tc;
+	newnode->variable.name = newnode->name;
 	return newnode;
 } // DeclarationNode::newTypeParam
@@ -341,6 +355,6 @@
 	DeclarationNode *newnode = new DeclarationNode;
 	newnode->type = new TypeData( TypeData::Attr );
-	newnode->type->attr.name = assign_strptr( name );
-	newnode->type->attr.expr = expr;
+	newnode->attr.name = assign_strptr( name );
+	newnode->attr.expr = expr;
 	return newnode;
 }
@@ -349,6 +363,6 @@
 	DeclarationNode *newnode = new DeclarationNode;
 	newnode->type = new TypeData( TypeData::Attr );
-	newnode->type->attr.name = assign_strptr( name );
-	newnode->type->attr.type = type;
+	newnode->attr.name = assign_strptr( name );
+	newnode->attr.type = type;
 	return newnode;
 }
@@ -542,8 +556,8 @@
 		break;
 	  case TypeData::Variable:
-		if ( type->variable.assertions ) {
-			type->variable.assertions->appendList( assertions );
+		if ( variable.assertions ) {
+			variable.assertions->appendList( assertions );
 		} else {
-			type->variable.assertions = assertions;
+			variable.assertions = assertions;
 		} // if
 		break;
@@ -896,5 +910,12 @@
 	if ( ! error.empty() ) throw SemanticError( error, this );
 	if ( type ) {
-		return buildDecl( type, name, storageClass, maybeBuild< Expression >( bitfieldWidth ), isInline, isNoreturn, linkage, maybeBuild< Initializer >(initializer) )->set_extension( extension );
+		if ( type->kind == TypeData::Variable ) {
+			static const TypeDecl::Kind kindMap[] = { TypeDecl::Any, TypeDecl::Ftype, TypeDecl::Dtype };
+			TypeDecl * ret = new TypeDecl( variable.name, DeclarationNode::NoStorageClass, 0, kindMap[ variable.tyClass ] );
+			buildList( variable.assertions, ret->get_assertions() );
+			return ret;
+		} else {
+			return buildDecl( type, name, storageClass, maybeBuild< Expression >( bitfieldWidth ), isInline, isNoreturn, linkage, maybeBuild< Initializer >(initializer) )->set_extension( extension );
+		} // if
 	} // if
 	if ( ! isInline && ! isNoreturn ) {
@@ -933,4 +954,16 @@
 		  return ret;
 	  }
+	  case TypeData::Attr: {
+		  assert( type->kind == TypeData::Attr );
+		  // assert( type->attr );
+		  AttrType * ret;
+		  if ( attr.expr ) {
+			  ret = new AttrType( buildQualifiers( type ), attr.name, attr.expr->build() );
+		  } else {
+			  assert( attr.type );
+			  ret = new AttrType( buildQualifiers( type ), attr.name, attr.type->buildType() );
+		  } // if
+		  return ret;
+	  }
 	  default:
 		return typebuild( type );
