[GD-Windows] VS 2003 generating duplicate COMDAT for template instantiation?
Brought to you by:
vexxed72
From: Jon W. <hp...@mi...> - 2007-05-12 00:47:36
|
I'm trying to generate a SAS parser/binder using just a little bit of template programing, and I'm running into the following link error (I'm using VS 2003). I would like any help I can get in how to work around this problem. I got it when I was reinterpret_cast-ing from type Foo::*Bar[N] to Foo::*Bar[], but I worked around that by explicitly passing in the array size. However, here there are no skanky casts involved; this should "just work." (And I've tried with and without the inline Access() function). Win32DX9Graphics.obj : fatal error LNK1179: invalid or corrupt file: duplicate COMDAT '?Access@?$FieldAccessor@USasAmbientLight@impl_DX9@@VFastTriple@pit@@$GA@A@A@@impl_DX9@@QAEABVFastTriple@pit@@ABUSasAmbientLight@2@@Z' Looking at the templates FieldAccessor, here is the code: template<typename Container, typename Type, Type Container::*Field> class FieldAccessor { public: typedef Container ContainerType; typedef Type FieldType; inline Type const &Access(Container const &c) { return c.*Field; } }; Here are the two cases where FieldAccessor<> is referenced for the SasAmbientLight: // dispatch the child if (!wcscmp(path, L"color")) { setter_ = PIT_SYSTEMNEW0("ValueSetter") ValueSetter< FieldAccessor<SasAmbientLight, pit::FloatTriple, &SasAmbientLight::color> > (this, core_->ambientlight_[l]); return true; } return false; ... // dispatch the child, then return an iterator on that if (!wcscmp(path, L"color")) { setter_ = PIT_SYSTEMNEW0("OuterArraySetter") OuterArraySetter< FieldAccessor<SasAmbientLight, pit::FloatTriple, &SasAmbientLight::color> > (this, core_->ambientlight_, &core_->numambientlights_.get()); return true; } return false; pit::FloatTriple is what you'd expect, as is struct SasAmbientLight: struct SasAmbientLight { pit::FloatTriple color; }; Btw: upgrading to 2005 isn't the preferred solution right now. |