Index: src/AST/Pass.impl.hpp
===================================================================
--- src/AST/Pass.impl.hpp	(revision 16ba4a6fa0eb60a0cd27fb96882e37dbf94834dd)
+++ src/AST/Pass.impl.hpp	(revision 080b0a1b9ea6f8e025d73f5d4a94ea745e9646f8)
@@ -423,5 +423,6 @@
 		}
 		catch( SemanticErrorException &e ) {
-			errors.append( e );
+			if (__pass::onError (visitor.core, *i, 0))
+				errors.append( e );
 		}
 
Index: src/AST/Pass.proto.hpp
===================================================================
--- src/AST/Pass.proto.hpp	(revision 16ba4a6fa0eb60a0cd27fb96882e37dbf94834dd)
+++ src/AST/Pass.proto.hpp	(revision 080b0a1b9ea6f8e025d73f5d4a94ea745e9646f8)
@@ -266,4 +266,15 @@
 	static void endTrace(core_t &, long) {}
 
+	// Allows visitor to handle an error on top-level declarations, and possibly suppress the error.
+	// If onError() returns false, the error will be ignored. By default, it returns true.
+
+	template< typename core_t >
+	static bool onError (core_t &, ptr<Decl> &, long) { return true; }
+
+	template< typename core_t >
+	static auto onError (core_t & core, ptr<Decl> & decl, int) -> decltype(core.onError(decl)) {
+		return core.onError(decl); 
+	}
+
 	// Another feature of the templated visitor is that it calls beginScope()/endScope() for compound statement.
 	// All passes which have such functions are assumed desire this behaviour
