Index: src/SynTree/Expression.cc
===================================================================
--- src/SynTree/Expression.cc	(revision c5e320873e53f7f0db647a4b0655a068e2d1c41e)
+++ src/SynTree/Expression.cc	(revision e6cee92975ba3e912a537934e3a775bcddc7a9fa)
@@ -502,5 +502,5 @@
 }
 
-AsmExpr::AsmExpr( const AsmExpr & other ) : inout( maybeClone( other.inout ) ), constraint( maybeClone( other.constraint ) ), operand( maybeClone( other.operand ) ) {}
+AsmExpr::AsmExpr( const AsmExpr & other ) : Expression( other ), inout( maybeClone( other.inout ) ), constraint( maybeClone( other.constraint ) ), operand( maybeClone( other.operand ) ) {}
 
 
Index: src/SynTree/ReferenceType.cc
===================================================================
--- src/SynTree/ReferenceType.cc	(revision c5e320873e53f7f0db647a4b0655a068e2d1c41e)
+++ src/SynTree/ReferenceType.cc	(revision e6cee92975ba3e912a537934e3a775bcddc7a9fa)
@@ -19,21 +19,26 @@
 
 ReferenceType::ReferenceType( const Type::Qualifiers &tq, Type *base, const std::list< Attribute * > & attributes )
-  : Type( tq, attributes ), base( base ) {
+	: Type( tq, attributes ), base( base ) {
+	assertf( base, "Reference Type with a null base created." );
 }
 
 ReferenceType::ReferenceType( const ReferenceType &other )
-  : Type( other ), base( maybeClone( other.base ) ) {
+	: Type( other ), base( maybeClone( other.base ) ) {
 }
 
 ReferenceType::~ReferenceType() {
-  delete base;
+	delete base;
+}
+
+int ReferenceType::referenceDepth() const {
+	return base->referenceDepth()+1;
 }
 
 void ReferenceType::print( std::ostream &os, int indent ) const {
-  Type::print( os, indent );
-  os << "reference to ";
-  if ( base ) {
-    base->print( os, indent );
-  } // if
+	Type::print( os, indent );
+	os << "reference to ";
+	if ( base ) {
+		base->print( os, indent );
+	} // if
 }
 
Index: src/SynTree/Type.cc
===================================================================
--- src/SynTree/Type.cc	(revision c5e320873e53f7f0db647a4b0655a068e2d1c41e)
+++ src/SynTree/Type.cc	(revision e6cee92975ba3e912a537934e3a775bcddc7a9fa)
@@ -81,4 +81,6 @@
 }
 
+int Type::referenceDepth() const { return 0; }
+
 void Type::print( std::ostream &os, int indent ) const {
 	if ( ! forall.empty() ) {
Index: src/SynTree/Type.h
===================================================================
--- src/SynTree/Type.h	(revision c5e320873e53f7f0db647a4b0655a068e2d1c41e)
+++ src/SynTree/Type.h	(revision e6cee92975ba3e912a537934e3a775bcddc7a9fa)
@@ -163,4 +163,7 @@
 	Type * stripReferences();
 
+	/// return the number of references occuring consecutively on the outermost layer of this type (i.e. do not count references nested within other types)
+	virtual int referenceDepth() const;
+
 	virtual bool isComplete() const { return true; }
 
@@ -304,4 +307,6 @@
 	void set_base( Type *newValue ) { base = newValue; }
 
+	virtual int referenceDepth() const;
+
 	virtual ReferenceType *clone() const { return new ReferenceType( *this ); }
 	virtual void accept( Visitor & v ) { v.visit( this ); }
Index: src/SynTree/TypeExpr.cc
===================================================================
--- src/SynTree/TypeExpr.cc	(revision c5e320873e53f7f0db647a4b0655a068e2d1c41e)
+++ src/SynTree/TypeExpr.cc	(revision e6cee92975ba3e912a537934e3a775bcddc7a9fa)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// TypeExpr.cc -- 
+// TypeExpr.cc --
 //
 // Author           : Richard C. Bilson
@@ -21,5 +21,5 @@
 }
 
-TypeExpr::TypeExpr( const TypeExpr &other ) : type( maybeClone( other.type ) ) {
+TypeExpr::TypeExpr( const TypeExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {
 }
 
