title: Why did C++03 require template parameters to have external linkage?
body: <h2>Background</h2>
  
  <p>In C++03, symbols used as template arguments must have external linkage; this restriction was removed in C++11, as explored in <a href="https://stackoverflow.com/questions/14595992/why-stdsort-doesnt-accept-compare-classes-declared-within-a-function"><em>this</em> previous question</a>:</p>
  
  <blockquote>
    <p>In C++03, template arguments could not have internal linkage:</p>
    
    <blockquote>
      <p><code>[C++03: 14.6.4.2/1]:</code> For a function call that depends on a template parameter, if the function name is an <em>unqualified-id</em> but not a <em>template-id</em>, the candidate functions are found using the usual lookup rules (3.4.1, 3.4.2) except that:</p>
      
      <ul>
      <li><strong>For the part of the lookup using unqualified name lookup</strong> (3.4.1), <strong>only function declarations with external linkage from the template definition context are found</strong>.</li>
      <li>For the part of the lookup using associated namespaces (3.4.2), only function declarations with external linkage found in either the template definition context or the template instantiation context are found.</li>
      </ul>
      
      <p><em>[..]</em></p>
    </blockquote>
    
    <p>This was changed (issue <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#561" rel="nofollow noreferrer">#561: "Internal linkage functions in dependent name lookup"</a>) in C++11:</p>
    
    <blockquote>
      <p><code>[C++11: C.2.6]:</code> 14.6.4.2 <br/>
      <strong>Change</strong>: Allow dependent calls of functions with internal linkage <br/>
      <strong>Rationale:</strong> Overly constrained, simplify overload resolution rules.</p>
    </blockquote>
    
    <p>resulting in:</p>
    
    <blockquote>
      <p><code>[C++11: 14.6.4.2/1]:</code> For a function call that depends on a template parameter, the candidate functions are found using the usual lookup rules (3.4.1, 3.4.2, 3.4.3) except that:</p>
      
      <ul>
      <li><strong>For the part of the lookup using unqualified name lookup</strong> (3.4.1) or qualified name lookup (3.4.3), <strong>only function declarations from the template definition context are found.</strong></li>
      <li>For the part of the lookup using associated namespaces (3.4.2), only function declarations found in either the template definition context or the template instantiation context are found.</li>
      </ul>
      
      <p><em>[..]</em></p>
    </blockquote>
    
    <p>(Spot the missing <em>"with external linkage"</em> qualification.)</p>
  </blockquote>
  
  <p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#561" rel="nofollow noreferrer">Issue #561 ("Internal linkage functions in dependent name lookup")</a>, the proposal that led to the restriction being removed in C++11, asks:</p>
  
  <blockquote>
    <p>Furthermore, is it really necessary to exclude internal linkage functions from the lookup? Doesn't the ODR give implementations sufficient latitude to handle this case without another wrinkle on name lookup?</p>
  </blockquote>
  
  <p>With the later answer:</p>
  
  <blockquote>
    <p>The consensus of the group was that <em>[..]</em> internal-linkage functions should be found by the lookup (although they may result in errors if selected by overload resolution).</p>
  </blockquote>
  
  <hr>
  
  <h2>Question</h2>
  
  <p><strong>What was the original practical rationale for the restriction?</strong></p>
  
  <p>It seems like there must have been one, since the original standard wording went out of its way to limit lookup to symbols with external linkage.</p>
  
  <p>Is it just that "[internal-linkage functions] may result in errors if selected by overload resolution", and that through the 2000s opinion shifted over how important this was? Or did something else change, perhaps as an indirect consequence of new wording elsewhere for a different C++11 feature?</p>