[Bug 24928] New: Evaluating expression returning an std::shared_ptr<T> fails

Bug ID 24928
Summary Evaluating expression returning an std::shared_ptr fails
Product lldb
Version unspecified
Hardware PC
OS All
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter tberghammer@google.com
CC llvm-bugs@lists.llvm.org
Classification Unclassified

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,
('_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)"