------- Comment #2 from rich at phekda dot gotadsl dot co dot uk 2007-01-03 21:45 ------- Created an attachment (id=12853) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12853&action=view) A test case
When I compile the attached test case, I get: [EMAIL PROTECTED] test-cases]$ make g++ -W -Wall -g hidden.cpp -o hidden hidden.cpp:5: warning: 'visibility' attribute ignored on non-class types Line 5 refers to the declaration with the attribute attached to the return type. Looking at the generated ELF file, I see that "func" is not hidden, but "func2" is: [EMAIL PROTECTED] test-cases]$ readelf -s hidden | c++filt | grep func 51: 080487f2 23 FUNC LOCAL DEFAULT 12 global constructors keyed to _Z4funcv 53: 08049e80 4 OBJECT LOCAL DEFAULT 25 func2()::foo2 55: 08049e90 4 OBJECT LOCAL DEFAULT 25 func()::foo 59: 08049e78 8 OBJECT LOCAL DEFAULT 25 guard variable for func2()::foo2 60: 08049e88 8 OBJECT LOCAL DEFAULT 25 guard variable for func()::foo 89: 080488fa 220 FUNC GLOBAL DEFAULT 12 func() 99: 0804881e 220 FUNC GLOBAL HIDDEN 12 func2() Version information: [EMAIL PROTECTED] test-cases]$ gcc --version gcc (GCC) 4.1.1 20061011 (Red Hat 4.1.1-30) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [EMAIL PROTECTED] test-cases]$ ld --version GNU ld version 2.17.50.0.3-6 20060715 Copyright 2005 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License. This program has absolutely no warranty. [EMAIL PROTECTED] test-cases]$ cat /etc/redhat-release Fedora Core release 6 (Zod) [EMAIL PROTECTED] test-cases]$ rpm -q gcc gcc-4.1.1-30 [EMAIL PROTECTED] test-cases]$ rpm -q binutils binutils-2.17.50.0.3-6 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30361