<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Codeview] Omitted class member function declaration for lambda."
   href="https://bugs.llvm.org/show_bug.cgi?id=46361">46361</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Codeview] Omitted class member function declaration for lambda.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>international.phantom@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given the following test case:

//------------------------------------------------------------
int test() {
  auto myLambdaFunction = [&](auto Param) {
    return Param;
  };

  return myLambdaFunction(1);
}
//------------------------------------------------------------

Using the command line to generate debug info CodeView:

clang -c -g -O0 lambda.cpp -o lambda-cv.o -gcodeview --target=x86_64-windows

The output generated by llvm-pdbutil, shows the definition for a member
function (operator ()), but it does not include its declaration in the class
associated with the lambda:

  0 | S_GPROC32_ID `test`
  0 | S_LOCAL `myLambdaFunction`
      type=0x1005 (test::<unnamed-tag>)
  0 | S_PROC_ID_END

** Class associated with lambda **
----------------------------------
0x1005 | LF_CLASS [size = 76] `test::<unnamed-tag>`
         unique name: `.?AV<lambda_0>@?0??test@@YAHXZ@`
         field list: 0x1004
0x1004 | LF_FIELDLIST      <--- Empty field list

** operator() definition **
---------------------------
  0 | S_LPROC32_ID `test::<unnamed-tag>::operator()<int>`
      type = `0x100C (operator())`
  0 | S_LOCAL `this`
      type=0x100D (const test::<unnamed-tag>*), flags = param
  0 | S_LOCAL [size = 16] `Param`
      type=0x0074 (int), flags = param
  0 | S_PROC_ID_END

0x100C | LF_MFUNC_ID
         name = operator(), type = 0x100B, class type = 0x1003
0x100B | LF_MFUNCTION
         return type = <no type>, # args = 1, param list = 0x100A
         class type = 0x1003, this type = 0x1009
0x100A | LF_ARGLIST
         0x0074 (int): `int`
0x1003 | LF_CLASS `test::<unnamed-tag>`
         options: forward ref

Using MSVC on the same test, the output looks like:

  0 | S_GPROC32_ID `test`
      type = `0x1015 (test)`
      original type = 0x100F
  0 | S_BPREL32 `myLambdaFunction`
      type = 0x100F
  0 | S_PROC_ID_END

0x100F | LF_CLASS `test::__l2::<lambda_5684e4bda96652f15ead82ba8f8a98f2>`
         unique name:
`.?AV<lambda_5684e4bda96652f15ead82ba8f8a98f2>@@`28ae9b9a`
         field list: 0x100E
0x100E | LF_FIELDLIST
         - LF_METHOD .....
         - LF_ONEMETHOD ....</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>