Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2004-11-29 11:54:00


John, now that you're at is_abstract, I wonder whether you could
consider adding some workaround in is_abstract.hpp making
boost::is_abstract return unconditionally false for those compilers
known not to work for it.
You can read about the origin of this request at:

http://aspn.activestate.com/ASPN/Mail/Message/boost/2209389

In a nutshell, Boost.Serialization does some (ODR-nonconformant)
redefinition of boost::is_abstract the way I'm suggesting. These
precautions are necessary because, on those compilers not
supporting the is_abstract implementation, the construct can crash
instead of returning false, and this makes it impossible to use
the facility without carefully taking care of the compiler.

The hack at Boost.Serialization is ugly as sin, it is dependant on the
order of header inclusion, violates ODR, etc., but if embedded
directly into is_abstract it'd be just fine, AFAICS.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

John Maddock ha escrito:

> > 1) a corrected version of is_abstract_template_test.cpp
>
> I've updated is_abstract test with your tests, found that VC7.1 has the same
> bug (?) as gcc-3.4 BTW.
>
> > 2) a patch to boost/type_traits/is_abstract.hpp that works around gcc
> > bug #17232.
> >
> > I would not be surprised if my patch turns out to be overly
> > complicated. I had assumed that any expression that involves
> > sizeof(T) causes the instantiation of T if T is a template
> > specialization. So I tried, e.g., to add the condition
> > sizeof(T) > 0 to the parameter list of ice_and in is_abstract_imp.
> > For some reason, though, whatever I tried showed no effect.
> > (Perhaps the compiler realized that the conditions I added were
> > true for any type T and eliminated the evaluation of sizeof(T)?)
> >
> > I finally settled for attached patch that adds a further struct in
> > which SFINAE is used again.
>
> I've simplified your fix down to a:
>
> BOOST_STATIC_ASSERT(sizeof(T));
>
> which also does the trick quite nicely.
>
> I'm running all the type traits tests through now, as long as there are no
> unexpected hiccups it'll all be in cvs soon.
>
> John.
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


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