On Mon, 24 Nov 2003, Peter Vanroose wrote:
> > Does the const in "<const float>" in the error message look suspicious to you?
> Maybe, yes. But I cannot see why vgui/vgui_soview2D.cxx would try to
> access something with a different signature than what
> vgl/Templates/vgl_distance+float-.cxx instantiates, since both are looking
> at the same template declaration in vgl/vgl_distance.h
> Could it have to do with different compiler options when building
> vgui/vgui_soview2D.cxx as compared to vgl/Templates/vgl_distance+float-.cxx ?
> Seems very unlikely to me, but that's all I can think of...
One of the known borland bugs is that it does not distinguish
instantiations based on top-level cv-qualifiers. That is, "A<int>" and
"A<int const>" are treated as the same instantiation or specialization.
This case seems to be the opposite problem, though. Perhaps the linker
does distinguish them. My guess is that this is happening:
template <class T> void foo(T);
// Source file foo+int-.cxx:
template void foo<int>(int); // Instantiates foo<int>
// Source file bar.cxx:
const int x;
foo(x); // Instantiates foo<int const>
foo(y); // Uses foo<int const> instantiation.
Then the linker sees bar.o and tries to find foo<int const>, but it has
This is only a guess. I have not yet looked at the problem in detail.
I'll have more time tomorrow to try it.