[container] Compilation failure with clang 3.1

Hello, When compiling Boost.Container, clang 3.1 (stable release, Mac OS X 10.7.4) fails:
/opt/local/include/boost/container/allocator/allocator_traits.hpp:167:105:
error: type name requires a specifier or qualifier
template <typename T> using rebind_alloc =
boost::intrusive::detail::type_rebinder
::type; ^
/opt/local/include/boost/container/allocator/allocator_traits.hpp:167:59:
error: expected ';' after alias declaration
template <typename T> using rebind_alloc =
boost::intrusive::detail::type_rebinder
::type; ^
;
/opt/local/include/boost/container/allocator/allocator_traits.hpp:168:72:
error: use of undeclared identifier 'rebind_alloc'
template <typename T> using rebind_traits = allocator_traits<
rebind_alloc<T> >;
^
/opt/local/include/boost/container/allocator/allocator_traits.hpp:168:85:
error: 'T' does not refer to a value
template <typename T> using rebind_traits = allocator_traits<
rebind_alloc<T> >;
^
/opt/local/include/boost/container/allocator/allocator_traits.hpp:168:29:
note: declared here
template <typename T> using rebind_traits = allocator_traits<
rebind_alloc<T> >;
^
/opt/local/include/boost/container/allocator/allocator_traits.hpp:168:87:
error: expected ';' after alias declaration
template <typename T> using rebind_traits = allocator_traits<
rebind_alloc<T> >;
However gcc 4.7 has no problem with it. Does anyone has experienced the same thing and possibly found a workaround? Thank you! Alexandre Hamez

On May 25, 2012, at 1:07 AM, Alexandre Hamez wrote:
Hello,
When compiling Boost.Container, clang 3.1 (stable release, Mac OS X 10.7.4) fails:
/opt/local/include/boost/container/allocator/allocator_traits.hpp:167:105: error: type name requires a specifier or qualifier template <typename T> using rebind_alloc = boost::intrusive::detail::type_rebinder
::type; ^ /opt/local/include/boost/container/allocator/allocator_traits.hpp:167:59: error: expected ';' after alias declaration template <typename T> using rebind_alloc = boost::intrusive::detail::type_rebinder ::type; ^ ; /opt/local/include/boost/container/allocator/allocator_traits.hpp:168:72: error: use of undeclared identifier 'rebind_alloc' template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >; ^ /opt/local/include/boost/container/allocator/allocator_traits.hpp:168:85: error: 'T' does not refer to a value template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >; ^ /opt/local/include/boost/container/allocator/allocator_traits.hpp:168:29: note: declared here template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >; ^ /opt/local/include/boost/container/allocator/allocator_traits.hpp:168:87: error: expected ';' after alias declaration template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >; However gcc 4.7 has no problem with it. Does anyone has experienced the same thing and possibly found a workaround?
Currently, on both the trunk and release branches, that line is:
template <typename T> using rebind_alloc = typename boost::intrusive::detail::type_rebinder

On Friday, May 25, 2012 2:38:24 PM UTC+2, Marshall Clow wrote:
On May 25, 2012, at 1:07 AM, Alexandre Hamez wrote:
Hello,
When compiling Boost.Container, clang 3.1 (stable release, Mac OS X 10.7.4) fails:
/opt/local/include/boost/container/allocator/allocator_traits.hpp:167:105:
error: type name requires a specifier or qualifier
template <typename T> using rebind_alloc =
boost::intrusive::detail::type_rebinder
::type; ^
/opt/local/include/boost/container/allocator/allocator_traits.hpp:167:59:
error: expected ';' after alias declaration
template <typename T> using rebind_alloc =
boost::intrusive::detail::type_rebinder
::type; ^
;
/opt/local/include/boost/container/allocator/allocator_traits.hpp:168:72:
error: use of undeclared identifier 'rebind_alloc'
template <typename T> using rebind_traits = allocator_traits<
rebind_alloc<T> >;
^
/opt/local/include/boost/container/allocator/allocator_traits.hpp:168:85:
error: 'T' does not refer to a value
template <typename T> using rebind_traits = allocator_traits<
rebind_alloc<T> >;
^
/opt/local/include/boost/container/allocator/allocator_traits.hpp:168:29:
note: declared here
template <typename T> using rebind_traits = allocator_traits<
rebind_alloc<T> >;
^
/opt/local/include/boost/container/allocator/allocator_traits.hpp:168:87:
error: expected ';' after alias declaration
template <typename T> using rebind_traits = allocator_traits<
rebind_alloc<T> >;
However gcc 4.7 has no problem with it. Does anyone has experienced the same thing and possibly found a workaround?
Currently, on both the trunk and release branches, that line is: template <typename T> using rebind_alloc = typename boost::intrusive::detail::type_rebinder
::type; (note the extra 'typename') You might try inserting that, and see if that fixes the problem.
Indeed, it works! I should have seen this problem... Anyway, thank you!
-- Marshall
Marshall Clow Idio Software
A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki
participants (2)
-
Alexandre Hamez
-
Marshall Clow