<html>
<head>
<base href="http://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 --- - #pragma visibility (GCC generates default, Clang hidden) if class forward declaration inserted into visibility push(hidden) section"
href="http://llvm.org/bugs/show_bug.cgi?id=22254">22254</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>#pragma visibility (GCC generates default, Clang hidden) if class forward declaration inserted into visibility push(hidden) section
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.abdurachmanov@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>GCC and Clang behaves differently if class forward declaration ends up in
visibility push(hidden) pragma section.
This was causing a linking errors in our software.
Quick discussion in #gcc suggests that this should be Clang issue:
[9:01pm] pinskia: davidlt, mainly because this is a GCC pragma that clang
implements
[9:01pm] davidlt: pinskia: I see
[9:03pm] pinskia: davidlt, and I think the reasoning is that the class B was
default first and then in the declared in the hidden section so the first one
overrides the second
[9:03pm] pinskia: davidlt, like doing:
[9:03pm] pinskia: #pragma GCC visibility push(hidden)
[9:03pm] pinskia: int v;
[9:03pm] pinskia: #pragma GCC visibility pop
[9:04pm] pinskia: int v;
[9:04pm] iains: davidlt: espindola is prob a good person to talk to about this
on #llvm (or here)
Tested with 3.7.0 (trunk, r226371).
class B {
virtual int tangentPlane();
public:
B();
};
class C : B {
public:
C() : B() {}
};
#pragma GCC visibility push(hidden)
class B;
void fn1() {
new C();
}
// GCC
//
// $ readelf --syms -W test_final.o | grep tangentPlane
// 31: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND
_ZN1B12tangentPlaneEv
//
// Clang
//
// $ readelf --syms -W test_final.o | grep tangentPlane
// 25: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND
_ZN1B12tangentPlaneEv</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>