Opened 17 years ago

Closed 14 years ago

#588 closed Bugs (fixed)

mpl::remove compile error with gcc 4.1.0

Reported by: eelis Owned by: Aleksey Gurtovoy
Milestone: Component: mpl
Version: None Severity: Problem
Keywords: Cc:

Description

The following four lines fail to compile using gcc
4.1.0 with boost 1.33.1:

  #include <boost/mpl/vector.hpp>
  #include <boost/mpl/remove.hpp>
  template <typename> struct X { struct type {}; };
  typedef boost::mpl::remove<boost::mpl::vector<int>,
X<int>::type>::type T;

Error:

boost/mpl/aux_/preprocessed/gcc/template_arity.hpp: In
instantiation of ‘const int
boost::mpl::aux::template_arity_impl<X<int>::type,
1>::value’:
boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:93:
  instantiated from ‘const int
boost::mpl::aux::template_arity<X<int>::type>::value’
boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:98:
  instantiated from
‘boost::mpl::aux::template_arity<X<int>::type>’
boost/mpl/aux_/preprocessed/gcc/full_lambda.hpp:123:  
instantiated from
‘boost::mpl::lambda<boost::mpl::same_as<X<int>::type>,
mpl_::void_, mpl_::int_<1> >’
boost/mpl/remove_if.hpp:57:   instantiated from
‘boost::mpl::aux::remove_if_impl<boost::mpl::vector<int,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na>,
boost::mpl::same_as<X<int>::type>,
boost::mpl::back_inserter<boost::mpl::vector0<mpl_::na>
> >’
boost/mpl/remove.hpp:33:   instantiated from
‘boost::mpl::aux::remove_impl<boost::mpl::vector<int,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na>, X<int>::type,
boost::mpl::back_inserter<boost::mpl::vector0<mpl_::na>
> >’
boost/mpl/remove.hpp:48:   instantiated from
‘boost::mpl::remove<boost::mpl::vector<int, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na>, X<int>::type, mpl_::na>’
t.cpp:4:   instantiated from here
boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:85:
error: call of overloaded
‘arity_helper(boost::mpl::aux::type_wrapper<X<int>::type>,
boost::mpl::aux::arity_tag<1>)’ is ambiguous
boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:30:
note: candidates are: char (&
boost::mpl::aux::arity_helper(...))[1]
boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:37:
note:                 char (&
boost::mpl::aux::arity_helper(boost::mpl::aux::type_wrapper<F<T1>
>, boost::mpl::aux::arity_tag<1>))[2] [with F = X<
<template-parameter-1-1> >::type, T1 = int]
boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:37:
note:                 char (&
boost::mpl::aux::arity_helper(boost::mpl::aux::type_wrapper<F<T1>
>, boost::mpl::aux::arity_tag<1>))[2] [with F = X<
<template-parameter-1-1> >::type, T1 = int]

The code compiles fine with gcc 4.0.2.

Change History (3)

comment:1 by eelis, 16 years ago

Logged In: YES 
user_id=832319

The error is caused by the following GCC bug:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27689

comment:2 by Aleksey Gurtovoy, 15 years ago

Severity: Problem

comment:3 by Aleksey Gurtovoy, 14 years ago

Resolution: Nonefixed
Status: assignedclosed

According to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27689#c7, the bug has been fixed in GCC 4.1.2.

I'm marking this as closed.

Note: See TracTickets for help on using tickets.