Boost logo

Boost :

From: Neal D. Becker (ndbecker2_at_[hidden])
Date: 2004-05-07 07:21:42


This simple test fails to compile on gcc-3.3.3. Any thoughts?

#include <boost/collection_traits.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

int F (int size) {
  int a[size];

  copy (boost::begin (a), boost::end (a), ostream_iterator<int> (cout, "
"));
}

g++ -o Test -g Test.cc -I /usr/local/src/boost_1_31_0
/usr/local/src/boost_1_31_0/boost/collection_traits/begin.hpp: In function `
   const T* boost::collection_traits::begin(const T (&)[sz])':
/usr/local/src/boost_1_31_0/boost/collection_traits/begin.hpp:70: error:
variable-size
   type declared outside of any function
/usr/local/src/boost_1_31_0/boost/collection_traits/begin.hpp:70: error:
variable-size
   type declared outside of any function
/usr/local/src/boost_1_31_0/boost/collection_traits/begin.hpp: In function
`T*
   boost::collection_traits::begin(T (&)[sz])':
/usr/local/src/boost_1_31_0/boost/collection_traits/begin.hpp:76: error:
variable-size
   type declared outside of any function
/usr/local/src/boost_1_31_0/boost/collection_traits/begin.hpp:76: error:
variable-size
   type declared outside of any function
Test.cc: In function `int F(int)':
Test.cc:11: error: call of overloaded `begin(int[((size - 1) + 1)])' is
   ambiguous
/usr/local/src/boost_1_31_0/boost/collection_traits/begin.hpp:101: error:
candidates
   are: wchar_t* boost::collection_traits::begin(wchar_t*) <near match>
/usr/local/src/boost_1_31_0/boost/collection_traits/begin.hpp:96: error:
            const wchar_t* boost::collection_traits::begin(const wchar_t*)
   <near match>
/usr/local/src/boost_1_31_0/boost/collection_traits/end.hpp: In function
`const
   T* boost::collection_traits::end(const T (&)[sz])':
/usr/local/src/boost_1_31_0/boost/collection_traits/end.hpp:71: error:
variable-size
   type declared outside of any function
/usr/local/src/boost_1_31_0/boost/collection_traits/end.hpp:71: error:
variable-size
   type declared outside of any function
/usr/local/src/boost_1_31_0/boost/collection_traits/end.hpp: In function `T*
   boost::collection_traits::end(T (&)[sz])':
/usr/local/src/boost_1_31_0/boost/collection_traits/end.hpp:77: error:
variable-size
   type declared outside of any function
/usr/local/src/boost_1_31_0/boost/collection_traits/end.hpp:77: error:
variable-size
   type declared outside of any function
Test.cc: In function `int F(int)':
Test.cc:11: error: call of overloaded `end(int[((size - 1) + 1)])' is
ambiguous
/usr/local/src/boost_1_31_0/boost/collection_traits/end.hpp:101: error:
candidates
   are: const wchar_t* boost::collection_traits::end(const wchar_t*) <near
   match>
/usr/local/src/boost_1_31_0/boost/collection_traits/end.hpp:91: error:
          wchar_t* boost::collection_traits::end(wchar_t*) <near match>


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