title: Working around a possible MSVC bug when deducing multiple variadic args
body: <p>Here is some code that compiles in GCC (on godbolt at least - can't test locally), for handling a compile-time dependency system - the conversion operator here is to make it easier to take an entity that specifies what it can read/write and reduce it down implicitly to a more restricted form when passing into functions (please pretend that the operator below does some static_assert kind of enforcement).</p>
  <pre><code>template&lt;typename... Args&gt;
  struct WriteList{};
  
  template&lt;typename... Args&gt;
  struct ReadList{};
  
  template&lt;typename Reads = ReadList&lt;&gt;, typename Writes = WriteList&lt;&gt;&gt;
  class TypedEntity;
  
  template &lt;typename... ReadTypes, template &lt;typename...&gt; typename Reads, typename... WriteTypes, template &lt;typename...&gt; typename Writes&gt;
  class TypedEntity&lt;Reads&lt;ReadTypes...&gt;, Writes&lt;WriteTypes...&gt;&gt;
  {
  public:
      template &lt;typename... OtherReadTypes, typename... OtherWriteTypes&gt;
      operator TypedEntity&lt;ReadList&lt;OtherReadTypes...&gt;, WriteList&lt;OtherWriteTypes...&gt;&gt;()
      {
          return {};
      }
  };
  
  struct ComponentA{};
  struct ComponentB{};
  struct ComponentC{};
  
  void TestFunc1(TypedEntity&lt;ReadList&lt;ComponentA, ComponentB&gt;, WriteList&lt;ComponentC&gt;&gt; entity)
  {
  
  }
  
  void TestFunc2(TypedEntity&lt;ReadList&lt;ComponentA&gt;, WriteList&lt;&gt;&gt; entity)
  {
  
  }
  
  void TestFunc3(TypedEntity&lt;ReadList&lt;ComponentA&gt;, WriteList&lt;ComponentC&gt;&gt; entity)
  {
  
  }
  
  int main()
  {
      TypedEntity&lt;ReadList&lt;ComponentA, ComponentB&gt;, WriteList&lt;ComponentB&gt;&gt; entity;
      TestFunc1(entity);
      TestFunc2(entity);
      TestFunc3(entity);    
  
      return 0;
  }
  </code></pre>
  <p>But under MSVC (latest, i.e.g 19.28, as well as some other 19.x versions I've sampled (19.14, 19.24, etc)):</p>
  <pre><code>error C3547: template parameter 'OtherWriteTypes' cannot be used because it follows a template parameter pack and cannot be deduced from the function parameters of 'TypedEntity&lt;Reads&lt;ReadTypes...&gt;,Writes&lt;WriteTypes...&gt;&gt;::operator TypedEntity&lt;ReadList&lt;OtherReadTypes...&gt;,WriteList&lt;OtherWriteTypes...&gt;&gt;'
  </code></pre>
  <ol>
  <li>Is this valid C++ and MSVC is wrong?</li>
  <li>Is there a workaround for this issue in MSVC?</li>
  </ol>
  <p>Appreciate it.</p>