From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6639 invoked by alias); 13 Apr 2012 12:36:22 -0000 Received: (qmail 6495 invoked by uid 22791); 13 Apr 2012 12:36:21 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_BJ X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 Apr 2012 12:36:09 +0000 From: "holger.hopp at sap dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug regression/52973] New: visibility attribute for class is not passed to its members Date: Fri, 13 Apr 2012 12:36:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: regression X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: holger.hopp at sap dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-04/txt/msg01016.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52973 Bug #: 52973 Summary: visibility attribute for class is not passed to its members Classification: Unclassified Product: gcc Version: 4.7.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression AssignedTo: unassigned@gcc.gnu.org ReportedBy: holger.hopp@sap.com In following code, gcc-4.7 does not accept the visibility attribute defined in the class declaration: template class __attribute__((visibility("default"))) a { public: /* A */ static int c; }; class __attribute__((visibility("default"))) b : a {}; template<> /* B */ int a::c = 0; With g++-4.7, a::c is hidden, with g++-4.6 (and before) it is not. $ g++-4.7 -fvisibility=hidden -c def.cpp && objdump -Ct def.o | grep "a" 0000000000000000 g O .bss 0000000000000004 .hidden a::c $ g++-4.6 -fvisibility=hidden -c def.cpp && objdump -Ct def.o | grep "a" 0000000000000000 g O .bss 0000000000000004 a::c Setting the default visibility at /* A */ or /* B */ works with g++-4.7, but I think that it still should work also with the code above.