Boost logo

Boost :

From: Christopher Cambly (ccambly_at_[hidden])
Date: 2007-10-26 13:10:11

"John Maddock" <john_at_[hidden]> wrote on 10/26/2007 03:28:05 AM:

> Joel,
> Fusion's tuple tests are passing with IBM xlc, but the TR1 tuple tests
> failing with problems with std::pair, which in turn causes all the
> Boost.Math tests to fail: it appears that just including the header
> ../boost/fusion/adapted/std_pair.hpp is enough to trigger the issue :-(
> See for a typical error message.
> Is this fixable, or should I degrade TR1 to the old tuples implementation

> for this compiler? BTW the old spirit-fusion code did work with xlc I
> believe.
> Chris: the code that's failing looks so innocuous it's hard to see how it

> could fail: there's nothing odd in xlc's headers like an extra defaulted
> template argument for std::pair is there?
> Thanks, John Maddock.

I believe I have a fix for this in the compiler. I ran a large batch of
tests last night but have not checked the results, however the smoke tests
I did run seemed ok. This compiler change will likely take some time to
make it into a production driver (on the order of a month or two if I can
sneak it in).

The problem with boost::fusion:traits::tag_of<>, and make_vector<> is that
we are not considering default arguments for partial specializations. The
code sequence is a forward declaration using default arguments followed by
a partial specialization definition.

Our compiler explicitly disallowed the checking of default arguments for
partial specilizations. Most likely this was just an oversight on our part,
but I will need to clarify with the standard.

Here is a small test-case that causes the error message as well show the

//Begin t.C
template <typename T0 = void, typename T1 = void> struct make_vector;
template <typename T0> struct make_vector<T0> { };
//End t.C

The workaround in the Boost source code would be to specify the default
argument explicitly. I tried the following change for
boost/fusion/adapter/std_pair.hpp and the error message disappeared.

--- boost/fusion/adapted/std_pair.hpp.orig 2007-10-26
11:31:11.276781194 -0400
+++ boost/fusion/adapted/std_pair.hpp 2007-10-26 11:31:32.676781424
@@ -20,7 +20,7 @@
     namespace traits
         template <typename T1, typename T2>
- struct tag_of<std::pair<T1, T2> >
+ struct tag_of<std::pair<T1, T2>, void >
             typedef struct_tag type;

Not an ideal fix, but illustrates where the change for our compiler is
necessary in the Boost source. The changes would need to be made in
fusion/adapter/std_pair.hpp, fusion/sequence/generation/make_vector.hpp,
fusion/sequence/generation/make_list.hpp to name a few :-(

So there is a source work around as well as a compiler fix. Like I
mentioned earlier it will be some time before the compiler change is
reflected into a production compiler. One of our internal requirements
that we have for publishing results is that the compiler used to publish
results has to be available to customers therefore I cannot use a
pre-release compiler for nightly Boost runs.

How would you like to proceed?

Chris Cambly
XL C++ Compiler Development

Boost list run by bdawes at, gregod at, cpdaniel at, john at