Index: src/AST/GenericSubstitution.cpp
===================================================================
--- src/AST/GenericSubstitution.cpp	(revision f23de79d3598c65a1d98ae2a637ac911add4fd81)
+++ src/AST/GenericSubstitution.cpp	(revision 0b8bf2756f5d522b7c14e40729098a2599ad2997)
@@ -23,5 +23,5 @@
 #include "Pass.hpp"
 #include "Type.hpp"
-#include "TypeSubstitution.cpp"
+#include "TypeSubstitution.hpp"
 
 namespace ast {
@@ -32,5 +32,5 @@
 
 		void previsit( const Type * ty ) {
-			assertf( false, "Attempted generic substitution for non-aggregate type: %s", 
+			assertf( false, "Attempted generic substitution for non-aggregate type: %s",
 				toString( ty ).c_str() );
 		}
Index: src/AST/Pass.proto.hpp
===================================================================
--- src/AST/Pass.proto.hpp	(revision f23de79d3598c65a1d98ae2a637ac911add4fd81)
+++ src/AST/Pass.proto.hpp	(revision 0b8bf2756f5d522b7c14e40729098a2599ad2997)
@@ -115,4 +115,24 @@
 		static constexpr bool value = std::is_void< ret_t >::value ||
 			std::is_base_of<const node_t, typename std::remove_pointer<ret_t>::type >::value;
+	};
+
+	template<bool is_void>
+	struct __assign;
+
+	template<>
+	struct __assign<true> {
+		template<typename pass_t, typename node_t>
+		static inline void result( pass_t & pass, const node_t * & node ) {
+			pass.previsit( node );
+		}
+	};
+
+	template<>
+	struct __assign<false> {
+		template<typename pass_t, typename node_t>
+		static inline void result( pass_t & pass, const node_t * & node ) {
+			node = pass.previsit( node );
+			assertf(node, "Previsit must not return NULL");
+		}
 	};
 
@@ -138,10 +158,10 @@
 			"Previsit may not change the type of the node. It must return its paremeter or void."
 		);
-		if(std::is_void< decltype( pass.previsit(node) ) >::value) {
-			pass.previsit( node );
-		} else {
-			node = pass.previsit( node );
-			assert(node);
-		}
+
+		__assign<
+			std::is_void<
+				decltype( pass.previsit( node ) )
+			>::value
+		>::result( pass, node );
 	}
 
Index: src/AST/module.mk
===================================================================
--- src/AST/module.mk	(revision f23de79d3598c65a1d98ae2a637ac911add4fd81)
+++ src/AST/module.mk	(revision 0b8bf2756f5d522b7c14e40729098a2599ad2997)
@@ -21,4 +21,5 @@
 	AST/DeclReplacer.cpp \
 	AST/Expr.cpp \
+	AST/GenericSubstitution.cpp \
 	AST/Init.cpp \
 	AST/LinkageSpec.cpp \
Index: src/Makefile.in
===================================================================
--- src/Makefile.in	(revision f23de79d3598c65a1d98ae2a637ac911add4fd81)
+++ src/Makefile.in	(revision 0b8bf2756f5d522b7c14e40729098a2599ad2997)
@@ -167,8 +167,9 @@
 am__objects_1 = AST/Attribute.$(OBJEXT) AST/Convert.$(OBJEXT) \
 	AST/Decl.$(OBJEXT) AST/DeclReplacer.$(OBJEXT) \
-	AST/Expr.$(OBJEXT) AST/Init.$(OBJEXT) \
-	AST/LinkageSpec.$(OBJEXT) AST/Node.$(OBJEXT) \
-	AST/Pass.$(OBJEXT) AST/Print.$(OBJEXT) AST/Stmt.$(OBJEXT) \
-	AST/Type.$(OBJEXT) AST/TypeSubstitution.$(OBJEXT)
+	AST/Expr.$(OBJEXT) AST/GenericSubstitution.$(OBJEXT) \
+	AST/Init.$(OBJEXT) AST/LinkageSpec.$(OBJEXT) \
+	AST/Node.$(OBJEXT) AST/Pass.$(OBJEXT) AST/Print.$(OBJEXT) \
+	AST/Stmt.$(OBJEXT) AST/Type.$(OBJEXT) \
+	AST/TypeSubstitution.$(OBJEXT)
 am__objects_2 = CodeGen/CodeGenerator.$(OBJEXT) \
 	CodeGen/FixMain.$(OBJEXT) CodeGen/GenType.$(OBJEXT) \
@@ -574,4 +575,5 @@
 	AST/DeclReplacer.cpp \
 	AST/Expr.cpp \
+	AST/GenericSubstitution.cpp \
 	AST/Init.cpp \
 	AST/LinkageSpec.cpp \
@@ -739,4 +741,6 @@
 	AST/$(DEPDIR)/$(am__dirstamp)
 AST/Expr.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp)
+AST/GenericSubstitution.$(OBJEXT): AST/$(am__dirstamp) \
+	AST/$(DEPDIR)/$(am__dirstamp)
 AST/Init.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp)
 AST/LinkageSpec.$(OBJEXT): AST/$(am__dirstamp) \
@@ -1173,4 +1177,5 @@
 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/DeclReplacer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Expr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/GenericSubstitution.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Init.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/LinkageSpec.Po@am__quote@
