title: Templates with same signature not causing a compiler error
body: <p>The following program defines two function templates, <code>A::foo&lt;&gt;()</code> and <code>B::foo&lt;&gt;()</code>, in two separate namespaces (<code>A</code> and <code>B</code>). The two function templates are <em>identical in signature</em>, and differ only in the default argument assigned to their second template parameter. Eventually, their names are brought into the scope of <code>main()</code> by a corresponding pair of <code>using</code> declarations:</p>
  
  <pre><code>#include &lt;type_traits&gt;
  
  namespace A
  {
      template&lt;
          typename T,
          typename = typename std::enable_if&lt;
              std::is_same&lt;T, int&gt;::value        // Let this be condition C
              &gt;::type
          &gt;
      void foo(T) { }
  }
  
  namespace B
  {
      template&lt;
          typename T,
          typename = typename std::enable_if&lt;
              !std::is_same&lt;T, int&gt;::value       // This is the negation of C
              &gt;::type
          &gt;
      void foo(T) { }
  }
  
  int main() {
      using A::foo;
      using B::foo; // COMPILES: Is this legal?
  
      foo(42); // Invokes A::foo(), non-ambiguous because of SFINAE
  }
  </code></pre>
  
  <p>I would expect the second <code>using</code> declaration to cause a compilation error here: after all, that is what I get when I try to define those two templates in the same namespace. </p>
  
  <p>To my surprise, every compiler I tried this on (GCC 4.7.2, GCC 4.8.0 beta, ICC 13.0.1, Clang 3.2) compiles the program and invokes <code>A::foo()</code>.</p>
  
  <p><strong>QUESTION #1: Is this correct?</strong> Is it perhaps a case of "<em>no diagnostic required</em>"? References to the C++11 Standard are encouraged.</p>
  
  <hr>
  
  <p>Consider now this variation of the above program, that basically achieves the same effect using classes rather than namespaces:</p>
  
  <pre><code>#include &lt;type_traits&gt;
  
  struct X
  {
      template&lt;
          typename T,
          typename = typename std::enable_if&lt;
              std::is_same&lt;T, int&gt;::value        // Here is condition C again
              &gt;::type
          &gt;
      static void foo(T) { }
  };
  
  struct Y
  {
      template&lt;
          typename T,
          typename = typename std::enable_if&lt;
              !std::is_same&lt;T, int&gt;::value       // And the negation of C again
              &gt;::type
          &gt;
      static void foo(T) { }
  };
  
  struct Z : X, Y
  {
     using X::foo;
     using Y::foo; // COMPILES: Is this legal?
  };
  
  int main() {
      Z::foo(42); // Invokes X::foo(), non-ambiguous because of SFINAE
  }
  </code></pre>
  
  <p>This program too compiles on all the above mentioned compilers, while I would expect a compiler error to be caused by the second <code>using</code> declaration.</p>
  
  <p><strong>QUESTION #2: Is this correct?</strong> Is it perhaps a case of "<em>no diagnostic required</em>"? References to the C++11 Standard are encouraged.</p>