From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3829 invoked by alias); 22 Jan 2006 23:56:45 -0000 Received: (qmail 3817 invoked by uid 48); 22 Jan 2006 23:56:43 -0000 Date: Sun, 22 Jan 2006 23:56:00 -0000 Subject: [Bug c++/25915] New: instantiated templates with anonymous classes as arguments should be static X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "sabre at nondot dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-01/txt/msg02303.txt.bz2 List-Id: Consider: --- template void bar() {} namespace { class C {};} void (*FP)() = bar; --- Because 'bar' is instantiated with 'C', a class in an anonymous namespace, this instantiation can never be shared across other translation units. As such, it should be marked static, to improve static and dynamic link times and improve future IPO potential. On PPC Darwin, the instantion of bar turns into: .section __TEXT,__textcoal_nt,coalesced,no_toc .align 2 .weak_definition __Z3barIN21_GLOBAL__N_t.cczMkGAb1CEEvv .private_extern __Z3barIN21_GLOBAL__N_t.cczMkGAb1CEEvv .section __TEXT,__textcoal_nt,coalesced,no_toc .align 2 __Z3barIN21_GLOBAL__N_t.cczMkGAb1CEEvv: blr -Chris -- Summary: instantiated templates with anonymous classes as arguments should be static Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sabre at nondot dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25915