Index: src/AST/Pass.impl.hpp
===================================================================
--- src/AST/Pass.impl.hpp	(revision 9a05b81d7121be1cbb9d49643339c40202e5d047)
+++ src/AST/Pass.impl.hpp	(revision 4c868cb2d605f52664207c4a1a18ed9f041e2057)
@@ -67,7 +67,11 @@
 		}
 
+		/// mutate should NEVER create new decl since it risks invalidating weak refs
+		/// called by visit template with correct type information so static type checking should suffice
 		template< typename core_t, typename node_t >
 		static inline node_t* mutate(const node_t *node) {
-			return std::is_base_of<PureVisitor, core_t>::value ? ::ast::shallowCopy(node) : ::ast::mutate(node);
+			// force copying non-decl nodes as a pure function
+			return std::is_base_of<PureVisitor, core_t>::value && !std::is_base_of<ast::Decl, node_t>::value
+			? ::ast::shallowCopy(node) : ::ast::mutate(node);
 		}
 
