[lldb-dev] [Bug 36451] New: Аmbiguous type of 'this'

via lldb-dev lldb-dev at lists.llvm.org
Tue Feb 20 04:11:20 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36451

            Bug ID: 36451
           Summary: Аmbiguous type of 'this'
           Product: lldb
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: dantipov at nvidia.com
                CC: llvm-bugs at lists.llvm.org

Test program...

class T0
{
protected:
  int x, y;
public:
  T0 (int a, int b) { x = a, y = b; }
  virtual int func (void) { return x + y; }
  int oops (void) { return x - y; }
};

class T1: public T0
{
public:
  T1 (int a, int b) : T0 (a, b) {}
  virtual int func (void) { return x + y + 1; }
};

class T2: public T1
{
  int z;
public:
  T2 (int a, int b) : T1 (a, b) { z = 111; }
  virtual int func (void) { return x + y + z + 2; }
};

int
main (int argc, char *argv[])
{
  T2 t (1, 2);
  return t.func () + t.oops ();
}

... in LLDB:

$ /home/dantipov/.local/llvm-6.0.0/bin/lldb t-class
(lldb) target create "t-class"
Current executable set to 't-class' (x86_64).
(lldb) b T0::oops
Breakpoint 1: where = t-class`T0::oops() at t-class.cc:8, address =
0x000000000040069c
(lldb) run
Process 8743 launched: '/home/dantipov/tmp/t-class' (x86_64)
Process 8743 stopped
* thread #1, name = 't-class', stop reason = breakpoint 1.1
    frame #0: 0x000000000040069c t-class`T0::oops(this=0x00007fffffffe1b0) at
t-class.cc:8
   5    public:
   6      T0 (int a, int b) { x = a, y = b; }
   7      virtual int func (void) { return x + y; }
-> 8      int oops (void) { return x - y; }
   9    };
   10   
   11   class T1: public T0
(lldb) p *this
(T0) $0 = (x = 1, y = 2)                      ;; '*this' is an instance of T0
(lldb) p this
(T2 *) $1 = 0x00007fffffffe1b0                ;; 'this' is a pointer to an
instance of T2, but...
(lldb) p this->x
(int) $4 = 1
(lldb) p this->y
(int) $5 = 2
(lldb) p this->z
error: no member named 'z' in 'T0'            ;; ...if so, where is this->z?

-- 
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/20180220/d3a9fea1/attachment.html>


More information about the lldb-dev mailing list