title: Ambiguous call to member function for captured this in a lambda
body: <p>I have encountered an issue when trying to call a member function inside a lambda for a captured <code>this</code>. There is a const and non-const version of the function and it is templated on a type.</p>
  
  <p>The following code demonstrates the error:</p>
  
  <pre><code>struct TEST
  {
    template &lt;typename T&gt;
    void test() {}
  
    template &lt;typename T&gt;
    void test() const {}
  
    TEST()
    {
      [this]()
      {
        test&lt;void&gt;();
      }();
    }
  };
  </code></pre>
  
  <p>Messages: <a href="http://rextester.com/MLU2098" rel="noreferrer">http://rextester.com/MLU2098</a></p>
  
  <pre class="lang-none prettyprint-override"><code>source_file.cpp(13): error C2668: 'TEST::test': ambiguous call to overloaded function
  source_file.cpp(7): note: could be 'void TEST::test&lt;void&gt;(void) const'
  source_file.cpp(4): note: or       'void TEST::test&lt;void&gt;(void)'
  source_file.cpp(13): note: while trying to match the argument list '()'
  Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64
  </code></pre>
  
  <p>I wasn't sure if this behaviour was correct and just an issue with the Microsoft compiler, so I tested the code with gcc and clang in the compiler explorer and they both compiled the code without an error.</p>
  
  <p>Which compiler is displaying the correct behaviour here?</p>