Compiler can't deduce the return type? : <p>I am trying to use the <code>decltype</code> keyword on an auto function:</p>

<pre><code>struct Thing {
   static auto foo() {
     return 12;
   }
   using type_t =
       decltype(foo());
};
</code></pre>

<p>And I get the following error (gcc 7.4):</p>

<pre><code>&lt;source&gt;:6:25: error: use of 'static auto Thing::foo()' before deduction of 'auto'
            decltype(foo());
                         ^
&lt;source&gt;:6:25: error: use of 'static auto Thing::foo()' before deduction of 'auto'
</code></pre>

<p>Why has the compiler not yet deduced the return type?</p>
