title: Static private function with templated type as a default argument in C++
body: <p>I have the following piece of C++17 code:</p>
  
  <pre><code>template &lt;typename Callback = void(*)()&gt;
  struct A {
      A(Callback c = &amp;noop) {}
  private:
      static void noop() {}
  };
  
  int main() {
      A a{};
  }
  </code></pre>
  
  <p>Clang 6 compiles this without any errors, but GCC 8.2 says:</p>
  
  <pre><code>In function ‘A(Callback)-&gt; A&lt;Callback&gt; [with Callback = void (*)()]’:
  3:24: error: ‘static void A&lt;Callback&gt;::noop() [with Callback = void (*)()]’ is private within this context
    A(Callback c = &amp;noop) {}
                   ^~~~~
  5:14: note: declared private here
    static void noop() {}
                ^~~~
  </code></pre>
  
  <p>Interestingly, if <code>Callback</code> is not a template argument but a simple type alias (i.e. if I write <code>using Callback = void (*)()</code> inside of the <code>A</code> class), both compilers are fine. Also, if instead of <code>A a{};</code> I explicitly write <code>A&lt;&gt; a{};</code>, both compilers are again fine. This leads me to think that this problem is somehow connected to the new C++17 class template deduction mechanism.</p>
  
  <p>My question is, which of the compilers is right according to the standard? Is this a GCC bug or is Clang being too permissive?</p>