<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 - lldb cannot deduce dynamic most derived type for types with lambda type as template argument"
   href="https://bugs.llvm.org/show_bug.cgi?id=40062">40062</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lldb cannot deduce dynamic most derived type for types with lambda type as template argument
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>erik@olofsson.info
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>main.cpp:

struct CStoreFunctor
{
        virtual ~CStoreFunctor() = default;
};

template <typename t_CFunctor>
struct TCStoreFunctor : public CStoreFunctor
{
        TCStoreFunctor(t_CFunctor _fFunctor)
                : m_fFunctor(_fFunctor)
        {
        }

        t_CFunctor m_fFunctor;
};

struct CTestFunctor
{
        void operator() () const
        {
        }
};


int main()
{
        TCStoreFunctor<CTestFunctor> Test0{{}};

        CStoreFunctor *pTest0 = &Test0;

        auto fTest = []
                {
                }
        ;

        TCStoreFunctor<decltype(fTest)> Test1{fTest};
        CStoreFunctor *pTest1 = &Test1;

        return 0;
}

# clang++ testdebug.cpp -g -o test -std=c++17
# lldb test
(lldb) break set --file main.cpp --line 39
(lldb) run
(lldb) p pTest0
(TCStoreFunctor<CTestFunctor> *) $0 = 0x00007ffeefbff7a8
(lldb) p pTest1
(CStoreFunctor *) $1 = 0x00007ffeefbff780

I tracked this down to ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress
where the type name is:
0x00007ffeefbff780: static-type = 'CStoreFunctor *' has vtable symbol 'vtable
for TCStoreFunctor<main::$_0>'

It's then using this name 'TCStoreFunctor<main::$_0>' to lookup the type with  
            FindTypes. The problem is that the dwarf info has another name for
this type:

(lldb) script
<span class="quote">>>> for type in lldb.target.GetModuleAtIndex(0).GetTypes():</span >
...     print type.GetName()
...
TCStoreFunctor<(lambda at main.cpp:31:15)>
TCStoreFunctor<(anonymous class)> *</pre>
        </div>
      </p>


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

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>