Index: src/Concurrency/Actors.cpp
===================================================================
--- src/Concurrency/Actors.cpp	(revision 046ba23776f868f7505bc5e1c9097e898a6df4d4)
+++ src/Concurrency/Actors.cpp	(revision e6d8d114c2f1a34e88d1f6cc47ad26c7792f201a)
@@ -45,16 +45,17 @@
     // finds and sets a ptr to the actor, message, and request structs, which are needed in the next pass
     void previsit( const StructDecl * decl ) {
-        GuardValue(insideStruct);
-        insideStruct = true;
-        parentDecl = mutate( decl );
-        if( decl->name == "actor" ) {
-            if ( actorDecl ) actorStructDecls.insert( decl ); // skip inserting fwd decl
+        if ( !decl->body ) return;
+        if ( decl->name == "actor" ) {
+            actorStructDecls.insert( decl ); // skip inserting fwd decl
             *actorDecl = decl;
-        }
-        if( decl->name == "message" ) {
-            if ( msgDecl ) messageStructDecls.insert( decl ); // skip inserting fwd decl
+        } else if( decl->name == "message" ) {
+            messageStructDecls.insert( decl ); // skip inserting fwd decl
             *msgDecl = decl;
-        }
-        if( decl->name == "request" ) *requestDecl = decl;
+        } else if( decl->name == "request" ) *requestDecl = decl;
+        else {
+            GuardValue(insideStruct);
+            insideStruct = true;
+            parentDecl = mutate( decl );
+        }
 	}
 
@@ -70,11 +71,15 @@
     }
 
-    // this collects the valid actor and message struct decl pts
+    // this collects the derived actor and message struct decl ptrs
     void postvisit( const StructInstType * node ) {
         if ( ! *actorDecl || ! *msgDecl ) return;
         if ( insideStruct && !namedDecl ) {
-            if ( node->aggr() == *actorDecl ) {
+            auto actorIter = actorStructDecls.find( node->aggr() );    
+            if ( actorIter != actorStructDecls.end() ) {
                 actorStructDecls.insert( parentDecl );
-            } else if ( node->aggr() == *msgDecl ) {
+                return;
+            }
+            auto messageIter = messageStructDecls.find( node->aggr() );
+            if ( messageIter != messageStructDecls.end() ) {
                 messageStructDecls.insert( parentDecl );
             }
@@ -186,5 +191,8 @@
 };
 
-struct GenReceiveDecls : public ast::WithDeclsToAdd<> {
+// generates the definitions of send operators for actors
+// collects data needed for next pass that does the circular defn resolution 
+//     for message send operators (via table above)
+struct GenFuncsCreateTables : public ast::WithDeclsToAdd<> {
     unordered_set<const StructDecl *> & actorStructDecls;
     unordered_set<const StructDecl *>  & messageStructDecls;
@@ -195,4 +203,5 @@
     FwdDeclTable & forwardDecls;
 
+    // generates the operator for actor message sends
 	void postvisit( const FunctionDecl * decl ) {
         // return if not of the form receive( param1, param2 ) or if it is a forward decl
@@ -213,9 +222,4 @@
         auto messageIter = messageStructDecls.find( arg2InstType->aggr() );
         if ( actorIter != actorStructDecls.end() && messageIter != messageStructDecls.end() ) {
-
-            // check that we have found all the decls we need from <actor.hfa>
-            if ( !*allocationDecl || !*requestDecl ) 
-                SemanticError( decl->location, "using actors requires a header, add #include <actor.hfa>\n" );
-
             //////////////////////////////////////////////////////////////////////
             // The following generates this send message operator routine for all receive(derived_actor &, derived_msg &) functions
@@ -347,5 +351,4 @@
             // forward decls to resolve use before decl problem for '|' routines
             forwardDecls.insertDecl( *actorIter, *messageIter , ast::deepCopy( sendOperatorFunction ) );
-            // forwardDecls.push_back( ast::deepCopy( sendOperatorFunction ) );
 
             sendOperatorFunction->stmts = sendBody;
@@ -355,5 +358,5 @@
 
   public:
-    GenReceiveDecls( unordered_set<const StructDecl *> & actorStructDecls, unordered_set<const StructDecl *> & messageStructDecls,
+    GenFuncsCreateTables( unordered_set<const StructDecl *> & actorStructDecls, unordered_set<const StructDecl *> & messageStructDecls,
         const StructDecl ** requestDecl, const EnumDecl ** allocationDecl, const StructDecl ** actorDecl, const StructDecl ** msgDecl, 
         FwdDeclTable & forwardDecls ) : actorStructDecls(actorStructDecls), messageStructDecls(messageStructDecls), 
@@ -361,9 +364,13 @@
 };
 
-struct GenFwdDecls : public ast::WithDeclsToAdd<> {
+
+// separate pass is needed since this pass resolves circular defn issues
+// generates the forward declarations of the send operator for actor routines
+struct FwdDeclOperator : public ast::WithDeclsToAdd<> {
     unordered_set<const StructDecl *> & actorStructDecls;
     unordered_set<const StructDecl *>  & messageStructDecls;
     FwdDeclTable & forwardDecls;
 
+    // handles forward declaring the message operator
     void postvisit( const StructDecl * decl ) {
         list<FunctionDecl *> toAddAfter;
@@ -392,7 +399,6 @@
 
   public:
-    GenFwdDecls( unordered_set<const StructDecl *> & actorStructDecls, unordered_set<const StructDecl *> & messageStructDecls, 
-        FwdDeclTable & forwardDecls ) : actorStructDecls(actorStructDecls), messageStructDecls(messageStructDecls),
-        forwardDecls(forwardDecls) {}
+    FwdDeclOperator( unordered_set<const StructDecl *> & actorStructDecls, unordered_set<const StructDecl *> & messageStructDecls, 
+        FwdDeclTable & forwardDecls ) : actorStructDecls(actorStructDecls), messageStructDecls(messageStructDecls), forwardDecls(forwardDecls) {}
 };
 
@@ -420,12 +426,16 @@
     Pass<CollectactorStructDecls>::run( translationUnit, actorStructDecls, messageStructDecls, requestDecl, 
         allocationDecl, actorDecl, msgDecl );
-	
+
+    // check that we have found all the decls we need from <actor.hfa>, if not no need to run the rest of this pass
+    if ( !allocationDeclPtr || !requestDeclPtr || !actorDeclPtr || !msgDeclPtr ) 
+        return;
+
     // second pass locates all receive() routines that overload the generic receive fn
     // it then generates the appropriate operator '|' send routines for the receive routines
-    Pass<GenReceiveDecls>::run( translationUnit, actorStructDecls, messageStructDecls, requestDecl, 
+    Pass<GenFuncsCreateTables>::run( translationUnit, actorStructDecls, messageStructDecls, requestDecl, 
         allocationDecl, actorDecl, msgDecl, forwardDecls );
 
     // The third pass forward declares operator '|' send routines
-    Pass<GenFwdDecls>::run( translationUnit, actorStructDecls, messageStructDecls, forwardDecls );
+    Pass<FwdDeclOperator>::run( translationUnit, actorStructDecls, messageStructDecls, forwardDecls );
 }
 
