<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - "non-virtual thunk" abi_tag mangling is different from g++"
href="https://llvm.org/bugs/show_bug.cgi?id=28997">28997</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>"non-virtual thunk" abi_tag mangling is different from g++
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>joubert.sy@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Hi,
This is an upstream bug report for the following Debian bug:
<a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=834492">https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=834492</a>
The new mangling behavior of clang++ for GCC abi_tag attribute seems to be
different from the g++ one on some edge cases.
Consider the following code:
$ cat classes.hpp
#include <string>
struct Mother
{
virtual ~Mother() {};
int bar;
};
struct Father
{
virtual std::string get_foo() = 0;
};
class Derived:
public Mother,
public Father
{
public:
std::string get_foo();
};
$ cat classes.cpp
#include "classes.hpp"
std::string Derived::get_foo() { return ""; }
$ cat main.cpp
#include "classes.hpp"
struct Final:
public Derived
{
};
int main()
{
Final().get_foo();
}
When compiling the classes with clang++ and trying to link the executable with
g++ one gets the following link error:
$ clang++-3.9 -c classes.cpp && g++-5 main.cpp classes.o
/tmp/cchpctTt.o:main.cpp:vtable for Final : erreur : référence à « non-
virtual thunk to Derived::get_foo() » non définie
collect2: error: ld returned 1 exit status
And it seems this symbol is mangled differently by clang++ and g++:
$ clang++-3.9 -c classes.cpp && nm -C classes.o | grep get_foo
0000000000000000 T Derived::get_foo[abi:cxx11]()
0000000000000070 T non-virtual thunk to Derived::get_foo[abi:cxx11]()
$ g++-5 -c classes.cpp && nm -C classes.o | grep get_foo
0000000000000000 T Derived::get_foo[abi:cxx11]()
0000000000000065 T non-virtual thunk to Derived::get_foo()
$ g++-6 -c classes.cpp && nm -C classes.o | grep get_foo
0000000000000000 T Derived::get_foo[abi:cxx11]()
0000000000000065 T non-virtual thunk to Derived::get_foo()</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>