[llvm-bugs] [Bug 36810] New: c++ visibility for specialization is not correct
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Mar 19 17:36:08 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=36810
Bug ID: 36810
Summary: c++ visibility for specialization is not correct
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: stevenwu at apple.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
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.
--
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/20180320/c11122d8/attachment.html>
More information about the llvm-bugs
mailing list