[llvm-bugs] [Bug 33473] New: operator new(size_t) can't have hidden visibility

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 15 11:19:19 PDT 2017


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

            Bug ID: 33473
           Summary: operator new(size_t) can't have hidden visibility
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: thomasanderson at google.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Compile the attached test.cpp with clang 5.0.0:
$ clang++ -fvisibility=hidden -nostdinc++ -std=c++11 -c test.cpp -o test.o

-fvisibility=hidden should make all symbols hidden, but operator new is not:

$ objdump -t test.o | grep _Znwm
0000000000000000 g     F .text  000000000000000f _Znwm
000000000000000f g     F .text  0000000000000013 .hidden _ZnwmRK9nothrow_t

Adding 'attribute((visibility("hidden")))' on operator new only raises an
error:

test.cpp:4:16: error: visibility does not match previous declaration
__attribute__((visibility("hidden")))
               ^
note: previous attribute is here
1 error generated.


I was told that this behavior is determined by a built-in declaration that is
added here:
http://llvm-cs.pcc.me.uk/tools/clang/lib/Sema/SemaExprCXX.cpp#2668

-- 
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/20170615/e66f2476/attachment.html>


More information about the llvm-bugs mailing list