Index: src/SynTree/Type.cc
===================================================================
--- src/SynTree/Type.cc	(revision d6d747d310b594f713f0f8df9f93ae69b21c6bf3)
+++ src/SynTree/Type.cc	(revision 6f950007fd85cf2f04928840823d690ed9c9d98b)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Mar 16 10:25:06 2017
-// Update Count     : 23
+// Last Modified On : Thu Mar 16 16:25:49 2017
+// Update Count     : 27
 //
 
@@ -19,4 +19,5 @@
 #include "Declaration.h"
 #include "Attribute.h"
+#include "InitTweak/InitTweak.h"
 #include "Common/utility.h"
 
@@ -64,4 +65,12 @@
 const char * Type::Qualifiers::Names[] = { "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic" };
 
+Type *Type::stripDeclarator() {
+	Type * type = this;
+	while ( Type * at = InitTweak::getPointerBase( type ) ) {
+		type = at;
+	}
+	return type;
+}
+
 void Type::print( std::ostream &os, int indent ) const {
 	if ( ! forall.empty() ) {
Index: src/SynTree/Type.h
===================================================================
--- src/SynTree/Type.h	(revision d6d747d310b594f713f0f8df9f93ae69b21c6bf3)
+++ src/SynTree/Type.h	(revision 6f950007fd85cf2f04928840823d690ed9c9d98b)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Mar 16 12:11:50 2017
-// Update Count     : 116
+// Last Modified On : Thu Mar 16 17:44:11 2017
+// Update Count     : 135
 //
 
@@ -21,11 +21,34 @@
 #include "SynTree.h"
 #include "Visitor.h"
+#include <strings.h>									// ffs
 
 class Type : public BaseSyntaxNode {
   public:
-	#define CommonBF( N ) \
+	// Simulate inheritance because union does not allow it.
+	#define BFCommon( BFType, N ) \
 		bool operator[]( unsigned int i ) const { return val & (1 << i); } \
 		bool any() const { return val != 0; } \
+		void reset() { val = 0; } \
+		int ffs() { return ::ffs( val ) - 1; } \
 		static const char * Names[]; \
+		BFType operator&=( BFType other ) { \
+			val &= other.val; return *this; \
+		} \
+	 	BFType operator&( BFType other ) const { \
+			BFType q = other; \
+			q &= *this; \
+			return q; \
+		} \
+	 	BFType operator|=( BFType other ) { \
+			val |= other.val; return *this; \
+		} \
+	 	BFType operator|( BFType other ) const { \
+			BFType q = other; \
+			q |= *this; \
+			return q; \
+		} \
+	 	BFType operator-=( BFType other ) { \
+			val &= ~other.val; return *this; \
+		} \
 		void print( std::ostream & os ) const { \
 			if ( (*this).any() ) { \
@@ -50,5 +73,7 @@
 		FuncSpecifiers() : val( 0 ) {}
 		FuncSpecifiers( unsigned int val ) : val( val ) {}
-		CommonBF( NumFuncSpecifier )
+		bool operator==( FuncSpecifiers other ) const {	return val == other.val; }
+		bool operator!=( FuncSpecifiers other ) const { return val != other.val; }
+		BFCommon( FuncSpecifiers, NumFuncSpecifier )
 	}; // FuncSpecifiers
 
@@ -66,5 +91,7 @@
 		StorageClasses() : val( 0 ) {}
 		StorageClasses( unsigned int val ) : val( val ) {}
-		CommonBF( NumStorageClass )
+		bool operator==( StorageClasses other ) const {	return val == other.val; }
+		bool operator!=( StorageClasses other ) const { return val != other.val; }
+		BFCommon( StorageClasses, NumStorageClass )
 	}; // StorageClasses
 
@@ -92,31 +119,10 @@
 		bool operator<=( Qualifiers other ) const {
 			return isConst <= other.isConst && isVolatile <= other.isVolatile &&
-				isMutex == other.isMutex && isAtomic == other.isAtomic;
+				isMutex >= other.isMutex && isAtomic == other.isAtomic;
 		}
-	 	bool operator>=( Qualifiers other ) const {
-			return isConst >= other.isConst	&& isVolatile >= other.isVolatile &&
-				isMutex == other.isMutex && isAtomic == other.isAtomic;
-		}
-		bool operator<( Qualifiers other ) const {
-			return *this != other && *this <= other;
-		}
-	 	bool operator>( Qualifiers other ) const {
-			return *this != other && *this >= other;
-		}
-		Qualifiers operator&=( Type::Qualifiers other ) {
-			val &= other.val; return *this;
-		}
-	 	Qualifiers operator+=( Qualifiers other ) {
-			val |= other.val; return *this;
-		}
-	 	Qualifiers operator-=( Qualifiers other ) {
-			val &= ~other.val; return *this;
-		}
-	 	Qualifiers operator+( Qualifiers other ) const {
-			Qualifiers q = other;
-			q += *this;
-			return q;
-		}
-		CommonBF( NumTypeQualifier )
+		bool operator<( Qualifiers other ) const { return *this != other && *this <= other; }
+	 	bool operator>=( Qualifiers other ) const { return ! (*this < other); }
+	 	bool operator>( Qualifiers other ) const { return *this != other && *this >= other; }
+		BFCommon( Qualifiers, NumTypeQualifier )
 	}; // Qualifiers
 
@@ -147,4 +153,6 @@
 	virtual bool isVoid() const { return size() == 0; }
 	virtual Type * getComponent( unsigned i ) { assertf( size() == 1 && i == 0, "Type::getComponent was called with size %d and index %d\n", size(), i ); return this; }
+
+	Type *stripDeclarator();
 
 	virtual bool isComplete() const { return true; }
Index: src/SynTree/TypeSubstitution.cc
===================================================================
--- src/SynTree/TypeSubstitution.cc	(revision d6d747d310b594f713f0f8df9f93ae69b21c6bf3)
+++ src/SynTree/TypeSubstitution.cc	(revision 6f950007fd85cf2f04928840823d690ed9c9d98b)
@@ -9,7 +9,7 @@
 // Author           : Richard C. Bilson
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Rob Schluntz
-// Last Modified On : Tue Apr 26 11:15:29 2016
-// Update Count     : 3
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Thu Mar 16 15:54:35 2017
+// Update Count     : 4
 //
 
@@ -127,5 +127,5 @@
 		subCount++;
 		Type *newtype = i->second->clone();
-		newtype->get_qualifiers() += inst->get_qualifiers();
+		newtype->get_qualifiers() |= inst->get_qualifiers();
 		delete inst;
 		return newtype;
