[lldb-dev] [Bug 16037] New: Expression evaluation for function call to templated class doesn't work

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 16 13:52:59 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16037

            Bug ID: 16037
           Summary: Expression evaluation for function call to templated
                    class doesn't work
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at cs.uiuc.edu
          Reporter: tareq.a.siraj at intel.com
    Classification: Unclassified

Created attachment 10528
  --> http://llvm.org/bugs/attachment.cgi?id=10528&action=edit
Reproducer source

Expression evaluation for a function call to a templated class seems to be
broken unless the same expression is used later in the body. Not sure if this
is a duplicate of 15879 or not.

Source:
struct Foo {
};

template <typename T>
class Ptr {
  T Val;

public:
  Ptr() : Val(T()) {}
  Ptr(T x) : Val(x) {}

  T get() const { return Val; }
};

typedef Ptr<Foo*> FooResult;

int main(void) {
  FooResult f = new Foo();
  // Uncommenting the following line seems to work.
  //Foo *p = f.get();
  return 0;
}

To reproduce:
clang++ bug.cpp -o bug -g3 && lldb bug
Current executable set to 'bug' (x86_64).
(lldb) breakpoint set -f bug.cpp -l 21
(lldb) process launch
Process 17771 launched: '/Users/tasiraj/dev/scratch/bug' (x86_64)
Process 17771 stopped
* thread #1: tid = 0x1c03, 0x0000000100000e9f bug`main + 47 at bug.cpp:21, stop
reason = breakpoint 1.1
    frame #0: 0x0000000100000e9f bug`main + 47 at bug.cpp:21
   18        FooResult f = new Foo();
   19        // Uncommenting the following line seems to work.
   20        //Foo *p = f.get();
-> 21        return 0;
   22      }
(lldb) print f
(FooResult) $0 = {
  (Foo *) Val = 0x00000001001000e0
}
(lldb) print f.get()
error: call to a function 'Ptr<Foo*>::get() const' that is not present in the
target
error: The expression could not be prepared to run in the target

versions (OSX):
clang --version
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.3.0
Thread model: posix

lldb --version
LLDB-179.1

OS: OSX 10.8.3, Linux

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20130516/24e29a44/attachment.html>


More information about the lldb-dev mailing list