Boost logo

Boost :

From: John Max Skaller (skaller_at_[hidden])
Date: 2001-05-29 10:55:26


Ross Smith wrote:
>
> John Max Skaller wrote:
> >
> > gcc 2.95.3 is useless. If you haven't broken it
> > in the regression tests, you haven't been trying.
> > It has a catastrophic bug: it expands inline methods of template classes
> > when it instantiates the class.
> >
> > The following example will fail for any smart pointer
> > class with an inline dispatch on the internal pointer:
> >
> > class Y { smart_ptr<X> x; };
> > class X { smart_ptr<Y> y; };
> >
> > Is there a way to turn off this non-conforming behaviour?
>
> What's non-conforming about it? The above code should certainly fail.

        The following works in C:

        struct X { struct X* x; };
        struct Y { struct Y* y; };

and replacing an X* with a smart_ptr<X> had better work, or templates
are utterly useless for building recursive data structures.
Perhaps you wanted me to prepend:

        class X;
        class Y;

??

But the example is a special case: just consider:

        template<class T1, class T2>
        struct X {
                smart_ptr<X<T2,T1> > ptr;
        };

to see that it isn't always possible to forward declare things.

-- 
John (Max) Skaller, mailto:skaller_at_[hidden]
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk