--- src/.svn/text-base/fortranscanner.l.svn-base	2011-06-30 22:02:54.372800000 +0200
+++ src/fortranscanner.l	2011-07-17 16:57:22.542000000 +0200
@@ -1739,8 +1758,11 @@
       //cout<<"Search in "<<scope->name<<endl;
       EntryListIterator eli(*scope->children());
       Entry *ce;
+      int count = 0;
+      int found = FALSE;
       for (;(ce=eli.current());++eli) 
       {
+        count++;
         if (ce->section != Entry::FUNCTION_SEC)
           continue;
 
@@ -1751,6 +1773,15 @@
 	  arg->name = arg->type;
           arg->type = scope->name;
         }
+        if (ce->name.lower() == scope->name.lower()) found = TRUE;
+      }
+      if ((count == 1) && found)
+      {
+        // clear all modifiers of the scope
+        modifiers.remove(scope);
+        delete scope->parent()->removeSubEntry(scope);
+        scope = 0;
+        return TRUE;
       }
     }
   } 
--- src/.svn/text-base/entry.h.svn-base	2011-06-30 22:02:51.349800000 +0200
+++ src/entry.h	2011-07-17 15:42:37.927983200 +0200
@@ -366,6 +366,8 @@
     bool        artificial;   //!< Artificially introduced item
     GroupDocType groupDocType;
 
+    Entry *removeSubEntry(Entry *e);
+
     static int  num;          //!< counts the total number of entries
 
     /// return the command name used to define GROUPDOC_SEC
--- src/.svn/text-base/entry.cpp.svn-base	2011-06-30 22:02:55.125800000 +0200
+++ src/entry.cpp	2011-07-17 15:55:37.355983200 +0200
@@ -360,6 +360,12 @@
   sli->append(ili);
 }
 
+Entry *Entry::removeSubEntry(Entry *e)
+{
+ int i = m_sublist->find(e);
+ return i!=-1 ? m_sublist->take(i) : 0;
+}
+
 //------------------------------------------------------------------
 
 
