Boost logo

Boost :

From: Matthias Troyer (troyer_at_[hidden])
Date: 2005-02-20 14:49:47


Hi,

Trying to combine boost multi_array and serialization I found a very
strange compiler bug (?) on MacOS X, using eother the Apple version of
gcc-3.1. The following simple code will not compile:

#include <boost/multi_array.hpp>

namespace strange_namespace {
class access {
};
}

int main()
{
   boost::multi_array<int,2> x(boost::extents[3][3]);
   int y=x[0][0];
}

It fails with the error message

src/boost/boost/multi_array/multi_array_ref.hpp: In member function
`typename
    boost::const_multi_array_ref<T, NumDims, T*>::reference
    boost::multi_array_ref<T, NumDims>::operator[](typename
    boost::const_multi_array_ref<T, NumDims, T*>::index) [with T = int,
long
    unsigned int NumDims = 2]':
test.C:11: instantiated from here
src/boost/boost/multi_array/multi_array_ref.hpp:512: no matching
function for
    call to `boost::const_multi_array_ref<int, 2, int*>::access(
    boost::type<boost::detail::multi_array::sub_array<int, 1> >, index&,
int*,
    const size_type*, const index*, const index*)'
src/boost/boost/multi_array/subarray.hpp: In member function `typename
    boost::detail::multi_array::const_sub_array<T, NumDims,
T*>::reference
    boost::detail::multi_array::sub_array<T,
NumDims>::operator[](typename
    boost::detail::multi_array::const_sub_array<T, NumDims, T*>::index)
[with T
    = int, long unsigned int NumDims = 1]':
test.C:11: instantiated from here
src/boost/boost/multi_array/subarray.hpp:261: no matching function for
call to
    `boost::detail::multi_array::const_sub_array<int, 1, int*>::access(
    boost::type<int&>, index&, int*&, const size_type*, const index*,
const
    index*)'

This looks like a compiler bug, since the code compiles when removing
the class definition access in a completely unrelated namespace. Has
something similar been observed before? Does anybody know a workaround?

Matthias


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk