|
Boost : |
From: Marcelo E. Magallon (mmagallo_at_[hidden])
Date: 2003-05-27 07:57:22
On Tue, May 27, 2003 at 12:22:27PM +0100, Reece Dunn wrote:
> > I'm baffled. The compiler says:
>
> [...]
>
> I got the same sort of messages. It is even harder when GCC says:
> parse error before ';'!!!!
Heh. I meant I was baffled by the problem at large, not by the
compiler message. 3.x is so much better in this respect! At least the
messages are readable now :-) (scary nightmares about those 1000+ lines
long messages because of a misplaced semicolon)
Anyway, I got it. Context diff against CVS attached.
> I think I understand why G++ 3.3 is getting confused. The
> constructors appear near the top of the class definition, for example
> quaternion< float >.
> [...]
> Try placing the constructor definitions at the end of the quaternion<
> float > and quaternion< double > declerations.
Yes, that sent me in the right direction, even if I still don't
understand what exactly is going on. At that point in the code the
compiler knows:
1. There's a template quaternion<T>
2. There's a method T quaternion<T>::R_component_1()
3. There's a forward declaration for a quaternion<float> and a
quaternion<double> specialization.
4. There's a function template for quaternion_type_converter<T,U>
5. Said function calls R_component_1()
6. Said function is instantiated for T=float, U=double.
7. At this point the compiler complains that:
float quaternion<float>::R_component_1()
is not defined. The compiler is right I guess, there's no
definition for that function, only a declaration (see 3.)
The patch makes a declaration for the function in 4. and pushes its
definition to the end of the file. That makes the compiler happy. I
don't think this will affect other compilers.
-- Marcelo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk