<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 fails to evaluate expression with template class type"
   href="https://bugs.llvm.org/show_bug.cgi?id=42920">42920</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLDB fails to evaluate expression with template class type
          </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>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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>sfunkenhauser@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>LLDB fails to evaluate expressions with template class types.

Simple example:
template <typename T> class foo

  uint32_t data;
};

foo<int> test;

int main() {
  return 0;
}

I set a breakpoint on main and try to evaluate the following expression:
(lldb) p sizeof(foo<int>)
error: implicit instantiation of undefined template 'foo<int>'
template is declared here

The debug information is available (It's not being optimized out), and printing
'test' works just fine:
$ readelf --debug-dump a.out | grep foo
    <41>   DW_AT_name        : (indirect string, offset: 0xa): foo<int>
    <49>   DW_AT_name        : (indirect string, offset: 0x0): foo
    3f          foo<int>

Quoting Jim Ingham from a discussion on lldb-dev@
"LLDB uses clang as its expression parser, which when it sees foo<int>
apparently wants to find a decl called "foo" first, which we don't really have
in the abstract."</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>