Index: src/AST/Decl.hpp
===================================================================
--- src/AST/Decl.hpp	(revision 04124c4c8fc28d94cb6020ef4a76198aa0f12299)
+++ src/AST/Decl.hpp	(revision e0115286f6b607d6d384675b446d21bc73745a4b)
@@ -122,5 +122,5 @@
 	std::vector<ptr<DeclWithType>> assertions;
 
-	NamedTypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, 
+	NamedTypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage,
 		Type* b, Linkage::Spec spec = Linkage::Cforall )
 	: Decl( loc, name, storage, spec ), base( b ), parameters(), assertions() {}
@@ -149,5 +149,5 @@
 		Data( TypeDecl* d ) : kind( d->kind ), isComplete( d->sized ) {}
 		Data( Kind k, bool c ) : kind( k ), isComplete( c ) {}
-		Data( const Data& d1, const Data& d2 ) 
+		Data( const Data& d1, const Data& d2 )
 		: kind( d1.kind ), isComplete( d1.isComplete || d2.isComplete ) {}
 
@@ -158,5 +158,5 @@
 	};
 
-	TypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, Type* b, 
+	TypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, Type* b,
 		Kind k, bool s, Type* i = nullptr )
 	: NamedTypeDecl( loc, name, storage, b ), kind( k ), sized( k == Ttype || s ), init( i ) {}
@@ -174,5 +174,5 @@
 class TypedefDecl final : public NamedTypeDecl {
 public:
-	TypedefDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, 
+	TypedefDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage,
 		Type* b, Linkage::Spec spec = Linkage::Cforall )
 	: NamedTypeDecl( loc, name, storage, b, spec ) {}
@@ -275,4 +275,43 @@
 };
 
+
+//=================================================================================================
+/// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency
+/// remove only if there is a better solution
+/// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with
+/// forward declarations
+inline void increment( const class Decl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class Decl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class DeclWithType * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class DeclWithType * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class ObjectDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class ObjectDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class FunctionDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class FunctionDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class AggregateDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class AggregateDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class StructDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class StructDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class UnionDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class UnionDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class EnumDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class EnumDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class TraitDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class TraitDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class NamedTypeDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class NamedTypeDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class TypeDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class TypeDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class FtypeDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class FtypeDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class DtypeDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class DtypeDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class TypedefDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class TypedefDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class AsmDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class AsmDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class StaticAssertDecl * node, Node::ref_type ref ) { node->increment(ref); }
+inline void decrement( const class StaticAssertDecl * node, Node::ref_type ref ) { node->decrement(ref); }
+
 }
 
Index: src/AST/Fwd.hpp
===================================================================
--- src/AST/Fwd.hpp	(revision 04124c4c8fc28d94cb6020ef4a76198aa0f12299)
+++ src/AST/Fwd.hpp	(revision e0115286f6b607d6d384675b446d21bc73745a4b)
@@ -16,7 +16,8 @@
 #pragma once
 
+#include "AST/Node.hpp"
+
 namespace ast {
 
-class Node;
 class ParseNode;
 
@@ -137,4 +138,228 @@
 class TypeSubstitution;
 
+//=================================================================================================
+/// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency
+/// remove only if there is a better solution
+/// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with
+/// forward declarations
+inline void decrement( const class Node * node, Node::ref_type ref ) { node->decrement(ref); }
+inline void increment( const class Node * node, Node::ref_type ref ) { node->increment(ref); }
+inline void increment( const class ParseNode *, Node::ref_type );
+inline void decrement( const class ParseNode *, Node::ref_type );
+inline void increment( const class Decl *, Node::ref_type );
+inline void decrement( const class Decl *, Node::ref_type );
+inline void increment( const class DeclWithType *, Node::ref_type );
+inline void decrement( const class DeclWithType *, Node::ref_type );
+inline void increment( const class ObjectDecl *, Node::ref_type );
+inline void decrement( const class ObjectDecl *, Node::ref_type );
+inline void increment( const class FunctionDecl *, Node::ref_type );
+inline void decrement( const class FunctionDecl *, Node::ref_type );
+inline void increment( const class AggregateDecl *, Node::ref_type );
+inline void decrement( const class AggregateDecl *, Node::ref_type );
+inline void increment( const class StructDecl *, Node::ref_type );
+inline void decrement( const class StructDecl *, Node::ref_type );
+inline void increment( const class UnionDecl *, Node::ref_type );
+inline void decrement( const class UnionDecl *, Node::ref_type );
+inline void increment( const class EnumDecl *, Node::ref_type );
+inline void decrement( const class EnumDecl *, Node::ref_type );
+inline void increment( const class TraitDecl *, Node::ref_type );
+inline void decrement( const class TraitDecl *, Node::ref_type );
+inline void increment( const class NamedTypeDecl *, Node::ref_type );
+inline void decrement( const class NamedTypeDecl *, Node::ref_type );
+inline void increment( const class TypeDecl *, Node::ref_type );
+inline void decrement( const class TypeDecl *, Node::ref_type );
+inline void increment( const class FtypeDecl *, Node::ref_type );
+inline void decrement( const class FtypeDecl *, Node::ref_type );
+inline void increment( const class DtypeDecl *, Node::ref_type );
+inline void decrement( const class DtypeDecl *, Node::ref_type );
+inline void increment( const class TypedefDecl *, Node::ref_type );
+inline void decrement( const class TypedefDecl *, Node::ref_type );
+inline void increment( const class AsmDecl *, Node::ref_type );
+inline void decrement( const class AsmDecl *, Node::ref_type );
+inline void increment( const class StaticAssertDecl *, Node::ref_type );
+inline void decrement( const class StaticAssertDecl *, Node::ref_type );
+inline void increment( const class Stmt *, Node::ref_type );
+inline void decrement( const class Stmt *, Node::ref_type );
+inline void increment( const class CompoundStmt *, Node::ref_type );
+inline void decrement( const class CompoundStmt *, Node::ref_type );
+inline void increment( const class ExprStmt *, Node::ref_type );
+inline void decrement( const class ExprStmt *, Node::ref_type );
+inline void increment( const class AsmStmt *, Node::ref_type );
+inline void decrement( const class AsmStmt *, Node::ref_type );
+inline void increment( const class DirectiveStmt *, Node::ref_type );
+inline void decrement( const class DirectiveStmt *, Node::ref_type );
+inline void increment( const class IfStmt *, Node::ref_type );
+inline void decrement( const class IfStmt *, Node::ref_type );
+inline void increment( const class WhileStmt *, Node::ref_type );
+inline void decrement( const class WhileStmt *, Node::ref_type );
+inline void increment( const class ForStmt *, Node::ref_type );
+inline void decrement( const class ForStmt *, Node::ref_type );
+inline void increment( const class SwitchStmt *, Node::ref_type );
+inline void decrement( const class SwitchStmt *, Node::ref_type );
+inline void increment( const class CaseStmt *, Node::ref_type );
+inline void decrement( const class CaseStmt *, Node::ref_type );
+inline void increment( const class BranchStmt *, Node::ref_type );
+inline void decrement( const class BranchStmt *, Node::ref_type );
+inline void increment( const class ReturnStmt *, Node::ref_type );
+inline void decrement( const class ReturnStmt *, Node::ref_type );
+inline void increment( const class ThrowStmt *, Node::ref_type );
+inline void decrement( const class ThrowStmt *, Node::ref_type );
+inline void increment( const class TryStmt *, Node::ref_type );
+inline void decrement( const class TryStmt *, Node::ref_type );
+inline void increment( const class CatchStmt *, Node::ref_type );
+inline void decrement( const class CatchStmt *, Node::ref_type );
+inline void increment( const class FinallyStmt *, Node::ref_type );
+inline void decrement( const class FinallyStmt *, Node::ref_type );
+inline void increment( const class WaitForStmt *, Node::ref_type );
+inline void decrement( const class WaitForStmt *, Node::ref_type );
+inline void increment( const class WithStmt *, Node::ref_type );
+inline void decrement( const class WithStmt *, Node::ref_type );
+inline void increment( const class DeclStmt *, Node::ref_type );
+inline void decrement( const class DeclStmt *, Node::ref_type );
+inline void increment( const class NullStmt *, Node::ref_type );
+inline void decrement( const class NullStmt *, Node::ref_type );
+inline void increment( const class ImplicitCtorDtorStmt *, Node::ref_type );
+inline void decrement( const class ImplicitCtorDtorStmt *, Node::ref_type );
+inline void increment( const class Expr *, Node::ref_type );
+inline void decrement( const class Expr *, Node::ref_type );
+inline void increment( const class ApplicationExpr *, Node::ref_type );
+inline void decrement( const class ApplicationExpr *, Node::ref_type );
+inline void increment( const class UntypedExpr *, Node::ref_type );
+inline void decrement( const class UntypedExpr *, Node::ref_type );
+inline void increment( const class NameExpr *, Node::ref_type );
+inline void decrement( const class NameExpr *, Node::ref_type );
+inline void increment( const class AddressExpr *, Node::ref_type );
+inline void decrement( const class AddressExpr *, Node::ref_type );
+inline void increment( const class LabelAddressExpr *, Node::ref_type );
+inline void decrement( const class LabelAddressExpr *, Node::ref_type );
+inline void increment( const class CastExpr *, Node::ref_type );
+inline void decrement( const class CastExpr *, Node::ref_type );
+inline void increment( const class KeywordCastExpr *, Node::ref_type );
+inline void decrement( const class KeywordCastExpr *, Node::ref_type );
+inline void increment( const class VirtualCastExpr *, Node::ref_type );
+inline void decrement( const class VirtualCastExpr *, Node::ref_type );
+inline void increment( const class MemberExpr *, Node::ref_type );
+inline void decrement( const class MemberExpr *, Node::ref_type );
+inline void increment( const class UntypedMemberExpr *, Node::ref_type );
+inline void decrement( const class UntypedMemberExpr *, Node::ref_type );
+inline void increment( const class VariableExpr *, Node::ref_type );
+inline void decrement( const class VariableExpr *, Node::ref_type );
+inline void increment( const class ConstantExpr *, Node::ref_type );
+inline void decrement( const class ConstantExpr *, Node::ref_type );
+inline void increment( const class SizeofExpr *, Node::ref_type );
+inline void decrement( const class SizeofExpr *, Node::ref_type );
+inline void increment( const class AlignofExpr *, Node::ref_type );
+inline void decrement( const class AlignofExpr *, Node::ref_type );
+inline void increment( const class UntypedOffsetofExpr *, Node::ref_type );
+inline void decrement( const class UntypedOffsetofExpr *, Node::ref_type );
+inline void increment( const class OffsetofExpr *, Node::ref_type );
+inline void decrement( const class OffsetofExpr *, Node::ref_type );
+inline void increment( const class OffsetPackExpr *, Node::ref_type );
+inline void decrement( const class OffsetPackExpr *, Node::ref_type );
+inline void increment( const class AttrExpr *, Node::ref_type );
+inline void decrement( const class AttrExpr *, Node::ref_type );
+inline void increment( const class LogicalExpr *, Node::ref_type );
+inline void decrement( const class LogicalExpr *, Node::ref_type );
+inline void increment( const class ConditionalExpr *, Node::ref_type );
+inline void decrement( const class ConditionalExpr *, Node::ref_type );
+inline void increment( const class CommaExpr *, Node::ref_type );
+inline void decrement( const class CommaExpr *, Node::ref_type );
+inline void increment( const class TypeExpr *, Node::ref_type );
+inline void decrement( const class TypeExpr *, Node::ref_type );
+inline void increment( const class AsmExpr *, Node::ref_type );
+inline void decrement( const class AsmExpr *, Node::ref_type );
+inline void increment( const class ImplicitCopyCtorExpr *, Node::ref_type );
+inline void decrement( const class ImplicitCopyCtorExpr *, Node::ref_type );
+inline void increment( const class ConstructorExpr *, Node::ref_type );
+inline void decrement( const class ConstructorExpr *, Node::ref_type );
+inline void increment( const class CompoundLiteralExpr *, Node::ref_type );
+inline void decrement( const class CompoundLiteralExpr *, Node::ref_type );
+inline void increment( const class UntypedValofExpr *, Node::ref_type );
+inline void decrement( const class UntypedValofExpr *, Node::ref_type );
+inline void increment( const class RangeExpr *, Node::ref_type );
+inline void decrement( const class RangeExpr *, Node::ref_type );
+inline void increment( const class UntypedTupleExpr *, Node::ref_type );
+inline void decrement( const class UntypedTupleExpr *, Node::ref_type );
+inline void increment( const class TupleExpr *, Node::ref_type );
+inline void decrement( const class TupleExpr *, Node::ref_type );
+inline void increment( const class TupleIndexExpr *, Node::ref_type );
+inline void decrement( const class TupleIndexExpr *, Node::ref_type );
+inline void increment( const class TupleAssignExpr *, Node::ref_type );
+inline void decrement( const class TupleAssignExpr *, Node::ref_type );
+inline void increment( const class StmtExpr *, Node::ref_type );
+inline void decrement( const class StmtExpr *, Node::ref_type );
+inline void increment( const class UniqueExpr *, Node::ref_type );
+inline void decrement( const class UniqueExpr *, Node::ref_type );
+inline void increment( const class UntypedInitExpr *, Node::ref_type );
+inline void decrement( const class UntypedInitExpr *, Node::ref_type );
+inline void increment( const class InitExpr *, Node::ref_type );
+inline void decrement( const class InitExpr *, Node::ref_type );
+inline void increment( const class DeletedExpr *, Node::ref_type );
+inline void decrement( const class DeletedExpr *, Node::ref_type );
+inline void increment( const class DefaultArgExpr *, Node::ref_type );
+inline void decrement( const class DefaultArgExpr *, Node::ref_type );
+inline void increment( const class GenericExpr *, Node::ref_type );
+inline void decrement( const class GenericExpr *, Node::ref_type );
+inline void increment( const class Type *, Node::ref_type );
+inline void decrement( const class Type *, Node::ref_type );
+inline void increment( const class VoidType *, Node::ref_type );
+inline void decrement( const class VoidType *, Node::ref_type );
+inline void increment( const class BasicType *, Node::ref_type );
+inline void decrement( const class BasicType *, Node::ref_type );
+inline void increment( const class PointerType *, Node::ref_type );
+inline void decrement( const class PointerType *, Node::ref_type );
+inline void increment( const class ArrayType *, Node::ref_type );
+inline void decrement( const class ArrayType *, Node::ref_type );
+inline void increment( const class ReferenceType *, Node::ref_type );
+inline void decrement( const class ReferenceType *, Node::ref_type );
+inline void increment( const class QualifiedType *, Node::ref_type );
+inline void decrement( const class QualifiedType *, Node::ref_type );
+inline void increment( const class FunctionType *, Node::ref_type );
+inline void decrement( const class FunctionType *, Node::ref_type );
+inline void increment( const class ReferenceToType *, Node::ref_type );
+inline void decrement( const class ReferenceToType *, Node::ref_type );
+inline void increment( const class StructInstType *, Node::ref_type );
+inline void decrement( const class StructInstType *, Node::ref_type );
+inline void increment( const class UnionInstType *, Node::ref_type );
+inline void decrement( const class UnionInstType *, Node::ref_type );
+inline void increment( const class EnumInstType *, Node::ref_type );
+inline void decrement( const class EnumInstType *, Node::ref_type );
+inline void increment( const class TraitInstType *, Node::ref_type );
+inline void decrement( const class TraitInstType *, Node::ref_type );
+inline void increment( const class TypeInstType *, Node::ref_type );
+inline void decrement( const class TypeInstType *, Node::ref_type );
+inline void increment( const class TupleType *, Node::ref_type );
+inline void decrement( const class TupleType *, Node::ref_type );
+inline void increment( const class TypeofType *, Node::ref_type );
+inline void decrement( const class TypeofType *, Node::ref_type );
+inline void increment( const class AttrType *, Node::ref_type );
+inline void decrement( const class AttrType *, Node::ref_type );
+inline void increment( const class VarArgsType *, Node::ref_type );
+inline void decrement( const class VarArgsType *, Node::ref_type );
+inline void increment( const class ZeroType *, Node::ref_type );
+inline void decrement( const class ZeroType *, Node::ref_type );
+inline void increment( const class OneType *, Node::ref_type );
+inline void decrement( const class OneType *, Node::ref_type );
+inline void increment( const class GlobalScopeType *, Node::ref_type );
+inline void decrement( const class GlobalScopeType *, Node::ref_type );
+inline void increment( const class Designation *, Node::ref_type );
+inline void decrement( const class Designation *, Node::ref_type );
+inline void increment( const class Init *, Node::ref_type );
+inline void decrement( const class Init *, Node::ref_type );
+inline void increment( const class SingleInit *, Node::ref_type );
+inline void decrement( const class SingleInit *, Node::ref_type );
+inline void increment( const class ListInit *, Node::ref_type );
+inline void decrement( const class ListInit *, Node::ref_type );
+inline void increment( const class ConstructorInit *, Node::ref_type );
+inline void decrement( const class ConstructorInit *, Node::ref_type );
+inline void increment( const class Constant *, Node::ref_type );
+inline void decrement( const class Constant *, Node::ref_type );
+inline void increment( const class Label *, Node::ref_type );
+inline void decrement( const class Label *, Node::ref_type );
+inline void increment( const class Attribute *, Node::ref_type );
+inline void decrement( const class Attribute *, Node::ref_type );
+inline void increment( const class TypeSubstitution *, Node::ref_type );
+inline void decrement( const class TypeSubstitution *, Node::ref_type );
+
 typedef unsigned int UniqueId;
 
Index: src/AST/Init.hpp
===================================================================
--- src/AST/Init.hpp	(revision 04124c4c8fc28d94cb6020ef4a76198aa0f12299)
+++ src/AST/Init.hpp	(revision e0115286f6b607d6d384675b446d21bc73745a4b)
@@ -28,5 +28,5 @@
 class Stmt;
 
-/// List of designator (NameExpr, VariableExpr, and ConstantExpr) expressions that specify an 
+/// List of designator (NameExpr, VariableExpr, and ConstantExpr) expressions that specify an
 /// object being initialized
 class Designation final : public ParseNode {
@@ -34,5 +34,5 @@
 	std::vector<ptr<Expr>> designators;
 
-	Designation( const CodeLocation& loc, std::vector<ptr<Expr>>&& ds = {} ) 
+	Designation( const CodeLocation& loc, std::vector<ptr<Expr>>&& ds = {} )
 	: ParseNode( loc ), designators( std::move(ds) ) {}
 
@@ -60,5 +60,5 @@
 	ptr<Expr> value;
 
-	SingleInit( const CodeLocation& loc, Expr* val, bool mc = false ) 
+	SingleInit( const CodeLocation& loc, Expr* val, bool mc = false )
 	: Init( loc, mc ), value( val ) {}
 
@@ -77,7 +77,7 @@
 	std::vector<ptr<Designation>> designations;
 
-	ListInit( const CodeLocation& loc, std::vector<ptr<Init>>&& is, 
+	ListInit( const CodeLocation& loc, std::vector<ptr<Init>>&& is,
 		std::vector<ptr<Designation>>&& ds = {}, bool mc = false );
-	
+
 	using iterator = std::vector<ptr<Init>>::iterator;
 	using const_iterator = std::vector<ptr<Init>>::const_iterator;
@@ -93,5 +93,5 @@
 
 /// Either a constructor expression or a C-style initializer.
-/// Should not be necessary to create manually; instead set `maybeConstructed` true on `SingleInit` 
+/// Should not be necessary to create manually; instead set `maybeConstructed` true on `SingleInit`
 /// or `ListInit` if the object should be constructed.
 class ConstructorInit final : public Init {
@@ -99,5 +99,5 @@
 	ptr<Stmt> ctor;
 	ptr<Stmt> dtor;
-	/// C-style initializer made up of SingleInit/ListInit nodes to use as a fallback if an 
+	/// C-style initializer made up of SingleInit/ListInit nodes to use as a fallback if an
 	/// appropriate constructor definition is not found by the resolver.
 	ptr<Init> init;
@@ -111,4 +111,18 @@
 };
 
+
+//=================================================================================================
+/// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency
+/// remove only if there is a better solution
+/// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with
+/// forward declarations
+inline void increment( const class Init * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class Init * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class SingleInit * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class SingleInit * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class ListInit * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class ListInit * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class ConstructorInit * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class ConstructorInit * node, Node::ref_type ref ) { node->decrement( ref ); }
 }
 
Index: src/AST/Label.hpp
===================================================================
--- src/AST/Label.hpp	(revision 04124c4c8fc28d94cb6020ef4a76198aa0f12299)
+++ src/AST/Label.hpp	(revision e0115286f6b607d6d384675b446d21bc73745a4b)
@@ -25,26 +25,35 @@
 namespace ast {
 
-	class Attribute;
+class Attribute;
 
-	/// Named labels for statements
-	class Label {
-	public:
-		CodeLocation location;
-		std::string name;
-		std::vector< ptr<Attribute> > attributes;
+/// Named labels for statements
+class Label {
+public:
+	CodeLocation location;
+	std::string name;
+	std::vector< ptr<Attribute> > attributes;
 
-		Label( CodeLocation loc, const std::string& name = "",
-			const std::vector<ptr<Attribute>>& attrs = std::vector<ptr<Attribute>>{} )
-		: location( loc ), name( name ), attributes( attrs ) {}
+	Label( CodeLocation loc, const std::string& name = "",
+		const std::vector<ptr<Attribute>>& attrs = std::vector<ptr<Attribute>>{} )
+	: location( loc ), name( name ), attributes( attrs ) {}
 
-		operator std::string () const { return name; }
-		bool empty() { return name.empty(); }
-	};
+	operator std::string () const { return name; }
+	bool empty() { return name.empty(); }
+};
 
-	inline bool operator== ( const Label& l1, const Label& l2 ) { return l1.name == l2.name; }
-	inline bool operator!= ( const Label& l1, const Label& l2 ) { return !(l1 == l2); }
-	inline bool operator<  ( const Label& l1, const Label& l2 ) { return l1.name < l2.name; }
+inline bool operator== ( const Label& l1, const Label& l2 ) { return l1.name == l2.name; }
+inline bool operator!= ( const Label& l1, const Label& l2 ) { return !(l1 == l2); }
+inline bool operator<  ( const Label& l1, const Label& l2 ) { return l1.name < l2.name; }
 
-	inline std::ostream& operator<< ( std::ostream& out, const Label& l ) { return out << l.name; }
+inline std::ostream& operator<< ( std::ostream& out, const Label& l ) { return out << l.name; }
+
+
+//=================================================================================================
+/// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency
+/// remove only if there is a better solution
+/// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with
+/// forward declarations
+inline void increment( const class Label * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class Label * node, Node::ref_type ref ) { node->decrement( ref ); }
 
 }
Index: src/AST/ParseNode.hpp
===================================================================
--- src/AST/ParseNode.hpp	(revision 04124c4c8fc28d94cb6020ef4a76198aa0f12299)
+++ src/AST/ParseNode.hpp	(revision e0115286f6b607d6d384675b446d21bc73745a4b)
@@ -22,18 +22,26 @@
 namespace ast {
 
-	/// AST node with an included source location
-	class ParseNode : public Node {
-	public:
-		CodeLocation location;
+/// AST node with an included source location
+class ParseNode : public Node {
+public:
+	CodeLocation location;
 
-		// Default constructor is deliberately omitted, all ParseNodes must have a location.
-		// Escape hatch if needed is to explicitly pass a default-constructed location, but
-		// this should be used sparingly.
+	// Default constructor is deliberately omitted, all ParseNodes must have a location.
+	// Escape hatch if needed is to explicitly pass a default-constructed location, but
+	// this should be used sparingly.
 
-		ParseNode( const CodeLocation& loc ) : Node(), location(loc) {}
+	ParseNode( const CodeLocation& loc ) : Node(), location(loc) {}
 
-		ParseNode( const ParseNode& o ) = default;
-	};
+	ParseNode( const ParseNode& o ) = default;
+};
 
+
+//=================================================================================================
+/// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency
+/// remove only if there is a better solution
+/// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with
+/// forward declarations
+inline void increment( const class ParseNode * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class ParseNode * node, Node::ref_type ref ) { node->decrement( ref ); }
 }
 
Index: src/AST/Stmt.hpp
===================================================================
--- src/AST/Stmt.hpp	(revision 04124c4c8fc28d94cb6020ef4a76198aa0f12299)
+++ src/AST/Stmt.hpp	(revision e0115286f6b607d6d384675b446d21bc73745a4b)
@@ -89,4 +89,52 @@
 
 
+//=================================================================================================
+/// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency
+/// remove only if there is a better solution
+/// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with
+/// forward declarations
+inline void increment( const class Stmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class Stmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class CompoundStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class CompoundStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class ExprStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class ExprStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class AsmStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class AsmStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class DirectiveStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class DirectiveStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class IfStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class IfStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class WhileStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class WhileStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class ForStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class ForStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class SwitchStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class SwitchStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class CaseStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class CaseStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class BranchStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class BranchStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class ReturnStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class ReturnStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class ThrowStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class ThrowStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class TryStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class TryStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class CatchStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class CatchStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class FinallyStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class FinallyStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class WaitForStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class WaitForStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class WithStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class WithStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class DeclStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class DeclStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class NullStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class NullStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class ImplicitCtorDtorStmt * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class ImplicitCtorDtorStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
+
 }
 
Index: src/AST/Type.hpp
===================================================================
--- src/AST/Type.hpp	(revision 04124c4c8fc28d94cb6020ef4a76198aa0f12299)
+++ src/AST/Type.hpp	(revision e0115286f6b607d6d384675b446d21bc73745a4b)
@@ -24,4 +24,54 @@
 };
 
+
+
+//=================================================================================================
+/// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency
+/// remove only if there is a better solution
+/// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with
+/// forward declarations
+inline void increment( const class Type * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class Type * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class VoidType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class VoidType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class BasicType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class BasicType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class PointerType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class PointerType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class ArrayType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class ArrayType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class ReferenceType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class ReferenceType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class QualifiedType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class QualifiedType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class FunctionType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class FunctionType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class ReferenceToType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class ReferenceToType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class StructInstType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class StructInstType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class UnionInstType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class UnionInstType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class EnumInstType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class EnumInstType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class TraitInstType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class TraitInstType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class TypeInstType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class TypeInstType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class TupleType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class TupleType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class TypeofType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class TypeofType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class AttrType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class AttrType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class VarArgsType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class VarArgsType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class ZeroType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class ZeroType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class OneType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class OneType * node, Node::ref_type ref ) { node->decrement( ref ); }
+inline void increment( const class GlobalScopeType * node, Node::ref_type ref ) { node->increment( ref ); }
+inline void decrement( const class GlobalScopeType * node, Node::ref_type ref ) { node->decrement( ref ); }
+
 }
 
