https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81107
Bug ID: 81107 Summary: operator new(size_t) can't have hidden visibility Product: gcc Version: 6.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: thomasanderson at google dot com Target Milestone: --- Created attachment 41559 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41559&action=edit test.cpp Compile the attached test.cpp with $ g++ -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: In function ‘void* operator new(size_t)’: test.cpp:5:7: warning: ‘void* operator new(size_t)’: visibility attribute ignored because it [-Wattributes] void* operator new(size_t size) { return (void*)1; } ^ <built-in>:0:0: warning: conflicts with previous declaration here [-Wattributes]