title: Why is SFINAE not applied in this example?
body: <p>I expected the following minimal example to compile by application of SFINAE:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;type_traits&gt;
  
  struct FallBack{};
  
  struct S {
      int bar() { return 42; }
  };
  
  template &lt;typename A, typename B&gt;
  std::enable_if_t&lt; (std::is_same&lt; std::enable_if_t&lt;true==FLAG, FallBack&gt;, FallBack&gt;::value and std::is_convertible&lt;B, std::string&gt;::value), int &gt;
      foo ( A a) { return a.bar();
  }
  
  
  template &lt;typename A, typename B&gt;
  std::enable_if_t&lt;false==FLAG, int&gt;
  foo ( A a) { std::cout &lt;&lt; "false solution " &lt;&lt; std::endl; return -1; }
  
  
  
  int main()
  {
      std::cout &lt;&lt; foo&lt;S, std::string&gt;( S{}) &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>to compile it: 
  <code>g++ -std=c++14 -DFLAG=1 myFile.cc</code></p>
  
  <p>If I comment the second <code>foo</code> function, everything works fine, therefore my understanding of SFINAE is incorrect; furthermore, the compiler complains about an ambiguity on the definition of <code>foo</code>.</p>
  
  <p>I am evidently wrong, but cannot see the problem.
  Could please anyone comment and explain why SFINAE is not applied? </p>