title: Cannot compile code with clang, but works with gcc
body: <p>I am trying to fix some bugs in an open source C++ project and the original author is currently too busy with his academic life to help. The code compiles just fine with <code>gcc-4.9</code> installed via macports. And I have been debugging with <code>lldb</code> on the command line. However, if possible, I would like to get the code to compile with <code>clang</code> since that would let me use Xcode and <code>lldb</code> together and make the bug easier to isolate.</p>
  
  <p>When I try to compile the code with <code>clang</code>, I get the following error: </p>
  
  <pre><code>In file included from ./src/include/hash.h:25:
  ./src/include/hash_stream.h:18:11: error: call to function 'operator&gt;&gt;' that is neither visible in the template definition
    nor found by argument-dependent lookup
    iss &gt;&gt; table[key] ;
        ^
  ./src/common/tagger/implementations/collins/tagger.h:118:9: note: in instantiation of function template specialization
    'operator&gt;&gt;&lt;CWord, english::CTag&gt;' requested here
    i &gt;&gt; (*m_TopTags);
      ^
  ./src/english/tags.h:29:23: note: 'operator&gt;&gt;' should be declared prior to the call site or in namespace 'english'
  inline std::istream &amp; operator &gt;&gt; (std::istream &amp;is, english::CTag &amp;tag) {
                    ^
  1 error generated.
  make: *** [obj/english.postagger.o] Error 1
  </code></pre>
  
  <p>This error occurs in <a href="https://github.com/desilinguist/zpar/blob/master/src/include/hash_stream.h" rel="noreferrer">this</a> file which is basically trying to read a key, a <code>:</code>, and a value separated by spaces into a custom hash map. I have read the relevant <a href="http://clang.llvm.org/compatibility.html#dep_lookup" rel="noreferrer">section</a> in the clang compatibility guide but I cannot figure out what I need to change to get this to compile.</p>
  
  <p><strong>EDIT</strong>: Per @m-s, I modified <code>src/common/tagger/implementations/collins/tagger_include.h</code> to move <code>tags.h</code> above <code>hash_stream.h</code> and that seemed to fix that error. However, I now run into a new error:</p>
  
  <pre><code>In file included from ./src/common/conparser/implementations/muhua/weight.cpp:13:
  In file included from ./src/common/conparser/implementations/muhua/weight.h:13:
  In file included from ./src/common/conparser/weight_base.h:13:
  In file included from ./src/common/conparser/base_include.h:10:
  In file included from ./src/english/tags.h:43:
  In file included from ./src/english/pos/penn_morph.h:15:
  In file included from ./src/include/knowledge/tagdict.h:15:
  In file included from ./src/include/hash.h:25:
  ./src/include/hash_stream.h:15:11: error: call to function 'operator&gt;&gt;' that is neither visible in the template definition
        nor found by argument-dependent lookup
        iss &gt;&gt; key;
            ^
  ./src/include/learning/perceptron/hashmap_score_packed.h:282:7: note: in instantiation of function template specialization
        'operator&gt;&gt;&lt;std::__1::pair&lt;unsigned long, unsigned long&gt;, CPackedScore&lt;double, 2048&gt; &gt;' requested here
     is &gt;&gt; static_cast&lt; CHashMap&lt; K, CPackedScore&lt;SCORE_TYPE, PACKED_SIZE&gt; &gt; &amp;&gt;(score_map) ;
        ^
  ./src/common/conparser/implementations/muhua/weight.cpp:48:27: note: in instantiation of function template specialization
        'operator&gt;&gt;&lt;std::__1::pair&lt;unsigned long, unsigned long&gt;, double, 2048&gt;' requested here
     iterate_templates(file &gt;&gt;,;);
                            ^
  ./src/common/conparser/implementations/muhua/weight.h:133:4: note: expanded from macro 'iterate_templates'
     left(m_mapS0cmN0tm)right\
     ^
  ./src/include/pair_stream.h:16:16: note: 'operator&gt;&gt;' should be declared prior to the call site
  std::istream &amp; operator &gt;&gt; (std::istream &amp;is, std::pair&lt;T1, T2&gt; &amp;p) {
                 ^
  1 error generated.
  make: *** [obj/english.conparser/weight.o] Error 1
  </code></pre>
  
  <p>I tried to include <code>pair_stream.h</code> before <code>hash.h</code> but that doesn't seem to work and I am stumped again. Any help would be much appreciated. </p>
  
  <p><strong>EDIT 2</strong>: I actually thought about things and took another stab at this and now it all works. Thanks, everyone! StackOverflow is awesome :)</p>