[GiNaC-list] Problem using a user-defined class on Mac OS X.

Alexei Sheplyakov varg at theor.jinr.ru
Wed Apr 4 08:55:46 CEST 2007


On Tue, Apr 03, 2007 at 07:42:46PM -0400, David Fang wrote:
 
> I may be jumping in a bit late, and without having looked through the
> source, but are we looking at a violation of the basic one-definition-rule
> (ODR)?

No. There are no multiple definitions. Only one specialization (which
provides best match) is selected by the compiler.

> whereby a specialization is providing a definition that is
> otherwise expected from a primary template?

C++ standard allows this (see e.g. 14.7.3).

So, this is OK:

template<typename T> class foo {
	static T data;
};

template<typename T> class foo<T*> {
	static void* data;
};

template<typename T> T foo<T>::data = T(1);

template<typename T> void* foo<T*>::data = 0;



> (For the record, which version
> are we looking at, so I may check it out?)

CVS HEAD.

Best regards,
 Alexei

-- 
All science is either physics or stamp collecting.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/ginac-list/attachments/20070404/e1c40015/attachment.pgp


More information about the GiNaC-list mailing list