title: Code compiles on MSVC, but not on GCC
body: <p>I'm new to GCC and am trying to port code to Linux which compiled OK with MSVC.
  The code below (a small program wich can be copypasted and compiled) produces the error:</p>
  
  <p>"there are no arguments to ‘num_obj_inc’ that depend on a template parameter, 
  so a declaration of ‘num_obj_inc’ must be available [-fpermissive]"</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  #define _SPTRDBG
  
  #ifdef _SPTRDBG
  #define SPTRDBG(x) x;
  #else
  #define SPTRDBG(x)
  #endif
  
  template&lt;bool&gt;
  struct objCounter
  {
      void num_obj_inc(){}
      void num_obj_dec(){}
  };
  
  template&lt;&gt;
  struct objCounter&lt;true&gt;
  {
  #ifdef _SPTRDBG
      static int num;
  
      void num_obj_inc() { num++; }
      void num_obj_dec() { num--; }
  #endif
  };
  
  template&lt;class C, bool bCnt=false&gt;
  class SPtr
                      : public objCounter&lt;bCnt&gt;
  {
      C* p;
  
  public:
  
      SPtr(C *_p)
          :p(_p)
      {
          if ( p ) {
              SPTRDBG( num_obj_inc() )
          }
      }
  };
  
  
  
  int main()
  {
      return 0;
  }
  </code></pre>
  
  <p>My guess was that GCC somehow optimize out the noop "num_obj_inc(){}", but this code compiles OK:</p>
  
  <pre><code>struct objCounter
  {
      void num_obj_inc(){}
      void num_obj_dec(){}
  };
  
  
  class SPtr
           : public objCounter
  {
  
  public:
  
      SPtr(int *p)
          //:p(_p)
      {
          if ( p ) {
              SPTRDBG( num_obj_inc() )
          }
      }
  };
  </code></pre>
  
  <p>What can be cause of the compilation error?</p>