title: Non pre-declared function call works for class types but not primitive types
body: <p>In the following code </p>
  
  <pre><code>template &lt;typename T&gt;
  void foo(T) {
      bar(T{});
  }
  
  class Something {};
  void bar(Something) {}
  
  int main() {
      foo(Something{});
  }
  </code></pre>
  
  <p>(<a href="https://wandbox.org/permlink/l2hxdZofLjZUoH4q" rel="noreferrer">https://wandbox.org/permlink/l2hxdZofLjZUoH4q</a>)</p>
  
  <p>When we call <code>foo()</code> with a <code>Something</code> parameter, everything works as expected, the call dispatches to the <code>bar(Something)</code> overload.  </p>
  
  <p>But when I change the argument to an integer and provide a <code>bar(int)</code> overload, I get an error</p>
  
  <pre><code>template &lt;typename T&gt;
  void foo(T) {
      bar(T{});
  }
  
  void bar(int) {}
  
  int main() {
      foo(int{});
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>error: call to function 'bar' that is neither visible in the template definition nor found by argument-dependent lookup
  </code></pre>
  
  <p>(<a href="https://wandbox.org/permlink/GI6wGlJYxGO4svEI" rel="noreferrer">https://wandbox.org/permlink/GI6wGlJYxGO4svEI</a>)</p>
  
  <p>In the class case, I have not defined <code>bar()</code> in a namespace along with the definition of <code>Something</code>.  Meaning that I am not getting ADL.  Then why does the code work with class types?</p>