|
Boost : |
Subject: [boost] [mpl] aux_::template_arity subtly broken on gcc-4.5
From: Eric Niebler (eric_at_[hidden])
Date: 2010-04-19 20:45:30
First, I freely acknowledge that I have been relying on an
implementation detail of MPL, and I will spend an appropriate amount of
time doing penance in programmer purgatory after I die. That said ...
Xpressive is broken on gcc-4.5 because mpl::aux_::template_arity is
causing instantiations on that compiler that it shouldn't. Consider the
following program that compiles on gcc-4.4 but not gcc-4.5.
#include <boost/mpl/aux_/template_arity.hpp>
#include <boost/mpl/aux_/lambda_arity_param.hpp>
template<class A>
struct T : A::x
{};
template<
class T
BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(
int Arity = boost::mpl::aux::template_arity<T>::value
)
>
struct S
{};
template<template<class A> class P, class X>
struct S<P<X> BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(1)>
{};
int main()
{
S<T<int> > s0;
}
The error I get is:
bug4109.cpp: In instantiation of T<int>:
../../../boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:85:5:
instantiated from const int
boost::mpl::aux::template_arity_impl<T<int>, 1>::value
../../../boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:93:5:
instantiated from const int boost::mpl::aux::template_arity<T<int>
>::value
../../../boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:98:30:
instantiated from boost::mpl::aux::template_arity<T<int> >
bug4109.cpp:23:14: instantiated from here
bug4109.cpp:6:3: error: int is not a class, struct, or union type
Any chance of a fix?
-- Eric Niebler BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk