<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Evaluating expression returning an std::shared_ptr<T> fails"
   href="https://llvm.org/bugs/show_bug.cgi?id=24928">24928</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Evaluating expression returning an std::shared_ptr<T> fails
          </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>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>tberghammer@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Compile the following code with the following command on Linux x86_64: "clang++
-g -std=c++11 main.cpp", then set a breakpoint on the marked line and evaluate
the expression "foo(sp)" while stopped at the breakpoint.

Expected behavior is to display the result of the expression, but lldb returns
with the following error message:
call to a function 'std::__shared_ptr<int,
__gnu_cxx::_Lock_policy>::~__shared_ptr()'
('_ZNSt12__shared_ptrIiN9__gnu_cxx12_Lock_policyEED2Ev') that is not present in
the target

Tested on Linux x86_64 with clang-3.5 and gcc-4.8.4

#include <memory>

std::shared_ptr<int> foo(const std::shared_ptr<int>& sp) {
    return sp;
}

int main() {
    std::shared_ptr<int> sp = std::make_shared<int>(42);
    auto sp2 = foo(sp);
    return 0; // Break here and run "expression foo(sp)"
}</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>