Boost logo

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

    class T
      int Arity = boost::mpl::aux::template_arity<T>::value
  struct S

  template<template<class A> class P, class X>

  int main()
    S<T<int> > s0;

The error I get is:

bug4109.cpp: In instantiation of ‘T<int>’:
instantiated from ‘const int
boost::mpl::aux::template_arity_impl<T<int>, 1>::value’
instantiated from ‘const int boost::mpl::aux::template_arity<T<int>
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

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