title: trailing return type of deduction guide is not a specialization
body: <p>I'm trying to do an advanced class template argument deduction by using the new deduction guides from c++17. Unfortunately, it looks like you can only use simple template declarations after the <code>-&gt;</code>, but I need a helper struct to determine the resulting type.</p>
  
  <p>My use case is this one: I have a variadic template class that takes an arbitrary amount of different types. For one constructor I want to specify every single one, for another ctor I want to specify only one type and replicate it N times.</p>
  
  <p>To access this <code>N</code> in the deduction guide I introduced a new type:</p>
  
  <pre><code>template&lt;size_t N&gt;
  struct Replicate { };
  </code></pre>
  
  <p>The class I have is similar this one:</p>
  
  <pre><code>template&lt;typename... Foos&gt;
  struct Foo {
      // [ ... ] member std::tuple&lt;Foos...&gt;
  
      // ctor 1: give values for all types (easy to deduce)
      Foo(Foos&amp;&amp;... args /* rvalue ref, NOT forwarding */) { };
  
      // ctor 2: give one value and N, result is N copies of this value. 
      // takes Replicate&lt;N&gt; as parameter to aid the deduction.
      template&lt;typename T, size_t N&gt;
      Foo(const T&amp; t, Replicate&lt;N&gt;) { };
  };
  </code></pre>
  
  <p>The usage would be like this:</p>
  
  <pre><code>Foo f1{1, 2, 3.0}; // deduce Foo&lt;int, int, double&gt;;
  Foo f2{8, Replicate&lt;4&gt;{}}; // deduce Foo&lt;int, int, int, int&gt;; 
  </code></pre>
  
  <p>The deduction guide for the first one is straight forward:</p>
  
  <pre><code>template&lt;typename... Ts&gt;
  Foo(Ts&amp;&amp;...) -&gt; Foo&lt;Ts...&gt;;
  </code></pre>
  
  <p>It gets problematic with the second (ctor 2) deduction guide. First I need a helper struct to create <code>Foo&lt;T, T, ... /* total N times */, T&gt;</code> from <code>T</code> and <code>N</code>.</p>
  
  <pre><code>template&lt;typename, typename, typename&gt;
  struct ExpandNTimes;
  
  template&lt;typename T, size_t... Is&gt;
  struct ExpandNTimes&lt;T, std::index_sequence&lt;Is...&gt;&gt; {
      template&lt;size_t&gt; using NthType = T;
      using Type = Foo&lt;NthType&lt;Is&gt;...&gt;;
  };
  </code></pre>
  
  <p>Then in the deduction guide I want to utilize the helper to deduce the correct type. I cant directly use <code>Foo&lt;something&gt;</code> as there is no kind of "in place parameter pack creation", therefore the helper struct.</p>
  
  <pre><code>template&lt;typename T, size_t N&gt;
  Foo(const T&amp;, Replicate&lt;N&gt;) -&gt; typename ExpandNTimes&lt;T, std::make_index_sequence&lt;N&gt;&gt;::Type;
  </code></pre>
  
  <p>Unfortunately this results int an error similar to this one:</p>
  
  <blockquote>
  <pre><code>error: trailing return type of 'typename ExpandNTimes&lt;T, /* std things */&gt;::Type' deduction guide is not a specialization of ‘Foo&lt;Ts&gt;’
  </code></pre>
  </blockquote>
  
  <p>Is there any way to work around this issue?</p>