[llvm-bugs] [Bug 25427] New: Hidden visibility vs extern template

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 5 18:11:15 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25427

            Bug ID: 25427
           Summary: Hidden visibility vs extern template
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eugeni.stepanov at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Hidden visibility attribute on an out-of-class definition of a template class
method is ignored.
Compare the following.


Attribute on the in-class declaration works:
$ cat good.cc
template<class T>
class A {
  void f(T t);
};

template<class T> __attribute__((visibility("hidden")))
void A<T>::f(T t) {}

template class A<int>;

$ clang++ ../llvm/good.cc -c && objdump -t good.o | grep ' F ' | c++filt
0000000000000000  w    F .text._ZN1AIiE1fEi    000000000000000d .hidden
A<int>::f(int)


Attribute on the out-of-class definition ignored:
$ cat bad.cc
template<class T>
class A {
  void f(T t);
};

template<class T>
__attribute__((visibility("hidden")))
void A<T>::f(T t) {}

template class A<int>;

$ ./bin/clang++ ../llvm/bad.cc -c && objdump -t bad.o | grep ' F ' | c++filt
0000000000000000  w    F .text._ZN1AIiE1fEi    000000000000000d A<int>::f(int)

-- 
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/20151106/df0076c7/attachment.html>


More information about the llvm-bugs mailing list