[llvm-bugs] [Bug 28940] LLDB calls wrong C++ method when virtual hides non-virtual
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 31 11:54:34 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=28940
Jonas Devlieghere <jdevlieghere at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|CONFIRMED |RESOLVED
CC| |jdevlieghere at apple.com
--- Comment #3 from Jonas Devlieghere <jdevlieghere at apple.com> ---
This was fixed by r323163.
$ cat /tmp/main.cpp
#include <stdint.h>
#include <stdio.h>
class A {
public:
A(int a = 0) : m_a(a) {}
virtual ~A() {}
virtual void Dump() { puts(__PRETTY_FUNCTION__); }
protected:
int m_a;
};
class B : public A {
public:
B(int a = 0, int b = 1) : A(a), m_b(b) {}
virtual ~B() {}
virtual void Dump() { puts(__PRETTY_FUNCTION__); }
protected:
int m_b;
};
int main(int argc, char const *argv[], char const *envp[]) {
B b(11, 22);
A *a = &b;
a->Dump();
return 0;
}
$ ./bin/lldb /tmp/a.out
(lldb) target create "/tmp/a.out"
Current executable set to '/tmp/a.out' (x86_64).
(lldb) b main.cpp:28
Breakpoint 1: where = a.out`main + 90 at main.cpp:28:3, address =
0x0000000100000d0a
(lldb) r
Process 34120 launched: '/tmp/a.out' (x86_64)
virtual void B::Dump()
Process 34120 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100000d0a a.out`main(argc=1, argv=0x00007ffeefbff650,
envp=0x00007ffeefbff660) at main.cpp:28:3
25 B b(11, 22);
26 A *a = &b;
27 a->Dump();
-> 28 return 0;
29 }
(lldb) p b.Dump()
virtual void B::Dump()
(lldb) p a->Dump()
virtual void B::Dump()
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190731/873eaa3a/attachment.html>
More information about the llvm-bugs
mailing list