With two-phase lookup errors in code that does not depend on template arguments are caught earlier (when the template is defined) than with one-phase lookup (when the template is instanciated). Which is why template code written for Visual Studio might not compile with a standard conforming compiler.<p>&gt;instantiating a template is literally a textual substitution<p>I&#x27;m being pedantic here, but that&#x27;s not quite the case. Example:<p><pre><code>  template &lt;typename T&gt;
  void foo()
  {
    T t;
    ...
  }

  foo&lt;int[2]&gt;();
</code></pre>
With simple textual substitution this would result in a syntax error, as<p><pre><code>  int[2] t;
</code></pre>
isn&#x27;t valid C++ code.