[llvm-bugs] [Bug 30695] New: Templated method inside a templated class ignores visibility attribute

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 13 18:59:45 PDT 2016


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

            Bug ID: 30695
           Summary: Templated method inside a templated class ignores
                    visibility attribute
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrewjcg at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 17441
  --> https://llvm.org/bugs/attachment.cgi?id=17441&action=edit
Code which repros the bug.

When compiling with either `-fvisibility=hidden` or
`-fvisibility-inlines-hidden`, templated class methods inside a templated class
do not respect the visibility attribute (e.g.
`__attribute__((visibility("default")))`) and remain hidden.

Repro code:

template<typename T>
class A {
  int a;
public:
  template<typename C>
  __attribute__ ((visibility ("default")))
  static void foo() {}
};

void func() {
  A<int>::foo<int>();
}


Then run, on the above code:
$ clang  -c -fvisibility=hidden -o test.o test.cpp
$ readelf -s test.o  # shows `void A<int>::foo<int>()` is HIDDEN

-- 
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/20161014/48e113ba/attachment.html>


More information about the llvm-bugs mailing list