[llvm-bugs] [Bug 32114] New: Method template visibility ignored on explicit template instantiations

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 1 18:46:13 PST 2017


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

            Bug ID: 32114
           Summary: Method template visibility ignored on explicit
                    template instantiations
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: smeenai at fb.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

% cat vis.cpp
template <class T> struct s {
  template <class U>
  __attribute__((__visibility__("hidden"))) U should_not_be_exported();
};

template <class T> template <class U> U s<T>::should_not_be_exported() {
  return U();
}

extern template struct __attribute__((__visibility__("default"))) s<int>;

int f() {
  s<int> o;
  return o.should_not_be_exported<int>();
}

% g++ -std=c++11 -fvisibility=hidden -fvisibility-inlines-hidden -shared -fPIC
-o libvis.so vis.cpp && nm -g --defined-only libvis.so | grep
should_not_be_exported

% ~/llvm/build/llvm/Release/bin/clang++ -std=c++11 -fvisibility=hidden
-fvisibility-inlines-hidden -shared -fPIC -o libvis.so vis.cpp && nm -g
--defined-only libvis.so | grep should_not_be_exported
00000000000006b0 W _ZN1sIiE22should_not_be_exportedIiEET_v

-- 
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/20170302/dac91c83/attachment.html>


More information about the llvm-bugs mailing list