
On Oct 21, 2010, at 9:12 AM, Lars Viklund wrote:
On Thu, Oct 21, 2010 at 07:49:29AM -0400, David Abrahams wrote:
At Wed, 20 Oct 2010 12:08:28 -0700, Marshall Clow wrote:
Yeah - it's complaining about a method in boost::array:
// Specific for boost::array: simply returns its elems data member. template <typename T, std::size_t N> T(&get_c_array(boost::array<T,N>& arg))[N] { return arg.elems; }
My guess is it can't parse the function-returning-reference-to-array syntax. You can try this instead:
namespace detail { template <typename T, std::size_t N> struct c_array { typedef T[N] type; }; }
// Specific for boost::array: simply returns its elems data member. template <typename T, std::size_t N> typename detail::c_array<T,N>::type& get_c_array(boost::array<T,N>& arg) { return arg.elems; }
That code, together with the corresponding const variant [1] of the second function, makes building --with-math get past the previous trouble spots without problems.
Thanks for the suggestion, Dave. Sadly, on my machine, both gcc 4.2.1 and clang 2.8 reject this code with: /Marshall/Sources/boost/trunk/boost/array.hpp:367:21: error: expected member name or ';' after declaration specifiers typedef T[N] type; ~~~~~~~~~^ 1 error generated. --- or --- ../../../boost/array.hpp:367: error: expected unqualified-id before '[' token This, however, seems to work: namespace detail { template <typename T, std::size_t N> struct c_array { typedef T type[N]; }; } I've checked this in as revision #66154 and will watch the tests cycle. -- Marshall