Explicit instantiation failing in 3.5 (boost)

Lars Gullik Bjønnes larsbj@gullik.net
Sat Jul 31 02:03:00 GMT 2004


This is adapted from code in connection.hpp in boost.

Should it work or is the code in fact wrong, and makes assumptions
that the standard does not provide?

------
#include <list>

struct bound_object {
        bool operator==(const bound_object& other) const;
        bool operator<(const bound_object& other) const;
};

template class std::list<bound_object>;
--------

g++ (GCC) 3.5.0 20040731 (experimental)

g++ -c -o alloc.o alloc.C
/opt/gcc-head/lib/gcc/i686-pc-linux-gnu/3.5.0/../../../../include/c++/3.5.0/bits/stl_list.h: In member function `std::_List_node<_Tp>* std::list<_Tp, _Alloc>::_M_create_node() [with _Tp = bound_object, _Alloc = std::allocator<bound_object>]':
alloc.C:8:   instantiated from here
/opt/gcc-head/lib/gcc/i686-pc-linux-gnu/3.5.0/../../../../include/c++/3.5.0/bits/stl_list.h:460: error: no matching function for call to `std::allocator<bound_object>::construct(bound_object*)'
/opt/gcc-head/lib/gcc/i686-pc-linux-gnu/3.5.0/../../../../include/c++/3.5.0/ext/mt_allocator.h:106: note: candidates are: void __gnu_cxx::__mt_alloc<_Tp>::construct(_Tp*, const _Tp&) [with _Tp = bound_object]


-- 
	Lgb



More information about the Libstdc++ mailing list