This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]