<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 - Аmbiguous type of 'this'"
href="https://bugs.llvm.org/show_bug.cgi?id=36451">36451</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Аmbiguous type of 'this'
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>dantipov@nvidia.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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?</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>