title: Template class compiles with C++17 but not with C++20 if unused function can't be compiled
body: <p>The following compiles without error in VS2019 (version 16.11.15) with C++ 17 selected as the language. But it fails with C++ 20 with error &quot;error C2027: use of undefined type 'Anon'&quot;</p>
  <pre><code>template &lt;typename T&gt; class a_template
  {
  public:
      void do_something(class Anon&amp; anon) const;
  };
  
  template &lt;typename T&gt; void a_template&lt;T&gt;::do_something(class Anon&amp; anon) const
  {
      anon.do_something();
  }
  </code></pre>
  <p>The <code>Anon</code> class is of course undefined but the ::do_something function is unused so does not need to be instantiated. This is OK in C++17 but apparently not in C++20.</p>
  <p>Is this a change in language rules? If so, can it be fixed without actually defining <code>Anon</code>?</p>