public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/25915]  New: instantiated templates with anonymous classes as arguments should be static
@ 2006-01-22 23:56 sabre at nondot dot org
  2006-01-23  0:17 ` [Bug c++/25915] " pinskia at gcc dot gnu dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: sabre at nondot dot org @ 2006-01-22 23:56 UTC (permalink / raw)
  To: gcc-bugs

Consider:

---
template <typename foo>
void bar() {}
namespace { class C {};}
void (*FP)() = bar<C>;
---

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


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2007-04-03 19:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-22 23:56 [Bug c++/25915] New: instantiated templates with anonymous classes as arguments should be static sabre at nondot dot org
2006-01-23  0:17 ` [Bug c++/25915] " pinskia at gcc dot gnu dot org
2006-01-23 14:43 ` [Bug c++/25915] instantiated templates with anonymous namespace class " pinskia at gcc dot gnu dot org
2006-01-23 20:43 ` geoffk at gcc dot gnu dot org
2006-01-23 21:24 ` [Bug c++/25915] use ODR rules to make C++ objects not be TREE_PUBLIC sabre at nondot dot org
2006-01-23 21:58 ` gdr at cs dot tamu dot edu
2006-01-23 22:00 ` sabre at nondot dot org
2006-03-09  0:35 ` geoffk at gcc dot gnu dot org
2006-04-05 22:27 ` jason at gcc dot gnu dot org
2006-04-05 22:49 ` jason at gcc dot gnu dot org
2006-06-21 19:07 ` pinskia at gcc dot gnu dot org
2006-06-21 19:51 ` gdr at integrable-solutions dot net
2006-06-21 20:45 ` geoffk at gcc dot gnu dot org
2006-06-30  1:17 ` jason at gcc dot gnu dot org
2006-06-30 15:28 ` pinskia at gcc dot gnu dot org
2006-08-28 12:28 ` jakub at gcc dot gnu dot org
2007-04-03 19:04 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).