[llvm-bugs] [Bug 39379] New: Visibility attribute is ignored on definition

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 22 07:06:52 PDT 2018


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

            Bug ID: 39379
           Summary: Visibility attribute is ignored on definition
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ldionne at apple.com
                CC: llvm-bugs at lists.llvm.org

In the following code, the visibility attribute appearing on the definition of
`bar()` appears to be dropped on the floor:

```
#define HIDDEN __attribute__((visibility("hidden")))

template <typename T>
struct A { static void bar(); };

template <typename T>
HIDDEN void A<T>::bar() { }

template void A<int>::bar();
```

Indeed, compiling with `clang++ -triple x86_64-unknown-linux-gnu -emit-llvm -o
- -` produces the following:

```
define weak_odr void @_ZN1AIiE3barEv() #0 comdat align 2 {
  ret void
}
```

Instead, I would expect the following if the attribute were not ignored:

```
define weak_odr hidden void @_ZN1AIiE3barEv() #0 comdat align 2 {
  ret void
}
```

-- 
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/20181022/1699e6fe/attachment-0001.html>


More information about the llvm-bugs mailing list