<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 - c++ visibility for specialization is not correct"
href="https://bugs.llvm.org/show_bug.cgi?id=36810">36810</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>c++ visibility for specialization is not correct
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>stevenwu@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Here is a reproducer:
$ cat test.ii
namespace std {
template <class>
class __attribute__((__type_visibility__("default"))) shared_ptr {
template <class> friend class shared_ptr;
};
} // namespace std
struct dict;
std::shared_ptr<dict> g; // comment out this line will change the visibility
for foo
class __attribute__((visibility("default"))) Bar;
template <class = std::shared_ptr<Bar>>
class __attribute__((visibility("default"))) i {
std::shared_ptr<int> foo() const;
};
template <> std::shared_ptr<int> i<>::foo() const {
return std::shared_ptr<int>();
}
$ clang -x c++ -fvisibility=hidden test.ii -emit-llvm -S -o test.ll && grep foo
test.ll
define hidden void @_ZNK1iISt10shared_ptrI3BarEE3fooEv(%class.i* %this)
After commenting out the declaration for 'g':
define void @_ZNK1iISt10shared_ptrI3BarEE3fooEv(%class.i* %this)
It seems that when LinkageComputer try to compute the visibility for foo(), it
try to get the TemplateDecl specialized by shared_ptr<Bar>, it gets the
TemplateDecl for friend class shared_ptr which doesn't have type_visibility.</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>