This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Mach-O and C++ static template definitions
- From: Michael Rosellini <m at netcabletv dot org>
- To: gcc at gcc dot gnu dot org
- Cc: Gianni Mariani <gianni at netcabletv dot org>
- Date: Mon, 28 Feb 2005 10:59:33 -0800
- Subject: Mach-O and C++ static template definitions
Presently, under OS X, GCC requires explicit definitions for static
template data members. That is,
template<typename T>
struct foo
{
static int x;
};
template<typename T>
int foo<T>::x;
causes problems at link time. An explicit definition of the x member
must be given for each instantiation of foo<T>, such as,
void funfun()
{
foo<int> f;
}
requires a definition
template<> int foo<int>::x;
somewhere if it is to link correctly.
Implicit definition of static template data members works properly for
ELF. Is there an ETA for support for this functionality for Mach-O?
Or, have I overlooked existing support?
(PS: I interpreted the documentation for -frepo as indicating that it
offered a solution for this problem. Experimentation suggests that I
was wrong. Please let me know if I'm mistaken; but this does not
answer my question, as -frepo results in an unacceptably long build
process.)
Thank you,
-m