|
Boost : |
From: John Maddock (john_at_[hidden])
Date: 2004-11-16 11:27:31
> 1) a corrected version of is_abstract_template_test.cpp
>
> When I prepared the original version I did not realize that
> is_abstract<T&>::value is supposed to be false for any type T.
>
> 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.
>
> With this patch gcc 3.4.2 passes both is_abstract_test.cpp as well as
> the attached is_abstract_template_test.cpp.
>
> I still would like to see something like is_abstract_template_test.cpp
> added to the type_traits tests. It is easy to introduce subtle bugs
> both in the compiler when implementing SFINAE and template
> instantiation as well as in the code relying on SFINAE.
I agree, sorry for not getting on top of this, but I will add your tests
into the type traits test suite at some point (and the patch as well
obviously).
Thanks for this,
John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk