title: Why does this SFINAE not work with enable_if when one conditional branch is inherited from the base class?
body: <pre><code>#include &lt;bits/stdc++.h&gt;
  #include &lt;type_traits&gt;
  
  // Type your code here, or load an example.
  template &lt;typename Types&gt;
  class C1 {
  public:
      using A=typename Types::A;
      using B=typename Types::B;
  
      template &lt;typename Dummy = void&gt;
      inline typename std::enable_if&lt;std::is_same&lt;A, B&gt;::value, Dummy&gt;::type f() { }
  
  };
  
  template &lt;typename Types&gt;
  class C2 : public C1&lt;Types&gt; {
  public:
      using A=typename Types::A;
      using B=typename Types::B;
  
      template &lt;typename Dummy = void&gt;
      inline typename std::enable_if&lt;!std::is_same&lt;A, B&gt;::value, Dummy&gt;::type f() { }
  
  };
  
  template &lt;typename Types&gt;
  class C3 : public C2&lt;Types&gt; {
  public:
      using A=typename Types::A;
      using B=typename Types::B;
  };
  
  
  struct Types{
      using A = int;
      using B = int;
  };
  
  int main() {
      C3&lt;Types&gt; c;
      c.f();
      return 0;
  }
  </code></pre>
  <p>When I try to compile the above code when A and B are not same, I get the following error:</p>
  <pre><code>&lt;source&gt;: In function 'int main()':
  &lt;source&gt;:42:9: error: no matching function for call to 'C3&lt;Types&gt;::f()'
     42 |     c.f();
        |         ^
  &lt;source&gt;:23:77: note: candidate: 'template&lt;class Dummy&gt; typename std::enable_if&lt;(! std::is_same&lt;typename Types::A, typename Types::B&gt;::value), Dummy&gt;::type C2&lt;Types&gt;::f() [with Dummy = Dummy; Types = Types]'
     23 |     inline typename std::enable_if&lt;!std::is_same&lt;A, B&gt;::value, Dummy&gt;::type f() { }
        |                                                                             ^
  &lt;source&gt;:23:77: note:   template argument deduction/substitution failed:
  &lt;source&gt;: In substitution of 'template&lt;class Dummy&gt; typename std::enable_if&lt;false, Dummy&gt;::type C2&lt;Types&gt;::f&lt;Dummy&gt;() [with Dummy = void]':
  &lt;source&gt;:42:9:   required from here
  &lt;source&gt;:23:77: error: no type named 'type' in 'struct std::enable_if&lt;false, void&gt;'
  
  </code></pre>
  <p>Note that the code I have presented is not the exact code I use but a minimal reproducible example</p>
  <p><strong>EDIT</strong>: Put up a minimal reproducible example using godbolt in place of the earlier for a better understanding of the situation</p>