[variant] regressions in GCC 2.95 --seemingly an MPL-related problem

I think I've reduced the problem Boost.Variant is having with GCC 2.95 (see for instance http://tinyurl.com/4sd7u and http://tinyurl.com/4dqqd) The attached snippet works OK for GCC 3.2 and other compilers, but ICEs on GCC 2.95, with the same problem shown in Boost.Variant. The culprit has to do with transform (and other MPL algoritmhs) dealing with expressions of the form: apply1<lambda<sizeof_<_1> >::type,_1> wich AFAIK are correct (otherwise somebody please correct me.) In case it is not possible to fix this in the MPL, I think I can hack a specific workaround for GCC 2.95 into the code of Boost.Variant, but I guess trying to fix MPL first is more sensible. HTH Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

The following is a somewhat shorter manifestation of the problem. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo Joaquín Mª López Muñoz ha escrito:
I think I've reduced the problem Boost.Variant is having with GCC 2.95 (see for instance http://tinyurl.com/4sd7u and http://tinyurl.com/4dqqd)
The attached snippet works OK for GCC 3.2 and other compilers, but ICEs on GCC 2.95, with the same problem shown in Boost.Variant.
The culprit has to do with transform (and other MPL algoritmhs) dealing with expressions of the form:
apply1<lambda<sizeof_<_1> >::type,_1>
wich AFAIK are correct (otherwise somebody please correct me.)
In case it is not possible to fix this in the MPL, I think I can hack a specific workaround for GCC 2.95 into the code of Boost.Variant, but I guess trying to fix MPL first is more sensible.
HTH
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
------------------------------------------------------------------------ Name: foo.cpp foo.cpp Type: Archivo de código fuente de C++ (application/x-unknown-content-type-cppfile) Encoding: base64
------------------------------------------------------------------------ _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

I've been investigating the problem a little further, and the final results are these: Seems like handling of MPL lambda expressions is difficult with GCC 2.95. The following snippet: typedef transform1< vector<char,int,double>, XXX
::type t1;
has several outcomes depending on XXX 1. identity<_1>: OK 2. mpl::sizeof<_1>: complains about an expression not being constant. However, code like this is embedded into Boost.Variant and seems to work fine (??) 3. boost::alignment_of<_1>: ICEs like I previously described. This is the error Boost.Variant is currently running into. My skills are too limited to be able to find a reason for this behavior, so I hope people smarter than me can do something with this. In case this problem is finally *not* taken care of, I've managed to workaround the regressions in Boost.Variant with a patch to be applied to boost/variant/variant.hpp (attached). Basically, the patch avoids the use of boost::aligment_of<_1> in favor of a more traditional metafunction class. So, if someone is able to fix this problem by touching either MPL or type_traits, so much the better. Otherwise, does anybody see a problem with me commiting the patch to Boost.Variant? Thank you, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo 206a207,226
#if BOOST_WORKAROUND(__GNUC__, <3)
/////////////////////////////////////////////////////////////////////////////// // (detail) metafunction alignment_of_helper // // GCC 2.95 ICEs under some circumsntances when using the lambda // expression alignment_of<mpl::_1>. alignment_of_helper is an equivalent // metafunction class. //
struct alignment_of_helper { template <typename T> struct apply: boost::alignment_of<T> { }; };
#endif // gcc 2.95
233a254,257
#if BOOST_WORKAROUND(__GNUC__, <3) types, alignment_of_helper // see description of alignment_of_helper #else
234a259,260
#endif

Joaquín Mª López Muñoz writes:
I've been investigating the problem a little further, and the final results are these:
Seems like handling of MPL lambda expressions is difficult with GCC 2.95. The following snippet:
typedef transform1< vector<char,int,double>, XXX
::type t1;
has several outcomes depending on XXX 1. identity<_1>: OK 2. mpl::sizeof<_1>: complains about an expression not being constant. However, code like this is embedded into Boost.Variant and seems to work fine (??) 3. boost::alignment_of<_1>: ICEs like I previously described. This is the error Boost.Variant is currently running into.
My skills are too limited to be able to find a reason for this behavior, so I hope people smarter than me can do something with this.
In case this problem is finally *not* taken care of, I've managed to workaround the regressions in Boost.Variant with a patch to be applied to boost/variant/variant.hpp (attached). Basically, the patch avoids the use of boost::aligment_of<_1> in favor of a more traditional metafunction class.
So, if someone is able to fix this problem by touching either MPL or type_traits, so much the better.
Joaquín, Thank you for investigating this! I'll dig a little further into it later tonight to see if we can fix it in MPL.
Otherwise, does anybody see a problem with me commiting the patch to Boost.Variant?
Nope, but let me try the above first. -- Aleksey Gurtovoy MetaCommunications Engineering

Aleksey Gurtovoy writes: Joaquín Mª López Muñoz writes:
In case this problem is finally *not* taken care of, I've managed to workaround the regressions in Boost.Variant with a patch to be applied to boost/variant/variant.hpp (attached). Basically, the patch avoids the use of boost::aligment_of<_1> in favor of a more traditional metafunction class.
So, if someone is able to fix this problem by touching either MPL or type_traits, so much the better.
Joaquín,
Thank you for investigating this! I'll dig a little further into it later tonight to see if we can fix it in MPL.
Fixed in the branch and the main trunk. Once again, thanks for looking into this! -- Aleksey Gurtovoy MetaCommunications Engineering

Aleksey Gurtovoy ha escrito:
Aleksey Gurtovoy writes: Joaquín Mª López Muñoz writes:
In case this problem is finally *not* taken care of, I've managed to workaround the regressions in Boost.Variant with a patch to be applied to boost/variant/variant.hpp (attached). Basically, the patch avoids the use of boost::aligment_of<_1> in favor of a more traditional metafunction class.
So, if someone is able to fix this problem by touching either MPL or type_traits, so much the better.
Joaquín,
Thank you for investigating this! I'll dig a little further into it later tonight to see if we can fix it in MPL.
Fixed in the branch and the main trunk. Once again, thanks for looking into this!
Thank *you* for fixing it :) Best, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
participants (2)
-
Aleksey Gurtovoy
-
Joaquín Mª López Muñoz