title: How to slove this error when using enable_if: "no type named ‘type’ in ‘struct std::enable_if<false, void>’"
body: <p>I want to invoke <code>pushArg()</code> method with different kinds of the type of <code>T</code>.</p>
  <p>Here is the relate code snippet:</p>
  <pre><code>//test.hpp
  struct Demo {int a};
  
  typedef int (*CALL_CFunction)(struct Demo* );
  
  classs Ctx
  {
      /*push bool */
      template &lt;typename T, 
                typename std::enable_if&lt;std::is_integral&lt;T&gt;::value&gt;::type* = nullptr,
                typename std::enable_if&lt;std::is_same&lt;T, bool&gt;::value&gt;::type* = nullptr&gt;
      int pushArg(T&amp; val)
      {
          std::std &lt;&lt; &quot;push bool&quot; &lt;&lt;std::endl;  
          return 0;
      }
  
      /*push lua_CFunction*/
      template &lt;typename T, 
            typename std::enable_if&lt;std::is_pointer&lt;T&gt;::value&gt;::type* = nullptr,
            typename std::enable_if&lt;std::is_same&lt;CALL_CFunction, T&gt;::value&gt;::type* = nullptr&gt;
      int pushArg(T&amp; val)
      {
          std::cout &lt;&lt; &quot;push function&quot; &lt;&lt; std::endl;
          return 0;
      }
  }
  </code></pre>
  <p>The function to call <code>pushArg()</code>:</p>
  <pre><code>int foo(Struct Demo *) {return 0;}
  Ctx ctx;
  ctx.pushArg(foo);
  </code></pre>
  <p>Here are the error meessages:</p>
  <pre><code>  test.cpp:36:22: error: no matching function for call to ‘ctx::pushArg(int (&amp;)(lua_State*))’
        pCtx-&gt;pushArg(foo);
                            ^
      In file included from test.cpp:1:0:
      test.hpp:131:9: note: candidate: template&lt;class T, typename std::enable_if&lt;std::is_integral&lt;_Tp&gt;::value&gt;::type* &lt;anonymous&gt;, typename std::enable_if&lt;std::is_same&lt;T, bool&gt;::value&gt;::type* &lt;anonymous&gt; &gt; int ctx::pushLuaArg(T&amp;)
           int pushLuaArg(T&amp; val)
               ^
      test.hpp:131:9: note:   template argument deduction/substitution failed:
      test.hpp:129:76: error: no type named ‘type’ in ‘struct std::enable_if&lt;false, void&gt;’
                 typename std::enable_if&lt;std::is_integral&lt;T&gt;::value&gt;::type* = nullptr,
                                                                              ^
  </code></pre>