[egcs-2.92.07 19980914] Bug with STL list template instantiation.
Hyman Rosen
hymie@prolifics.com
Tue Sep 15 17:17:00 GMT 1998
A new bug has appeared in the latest snapshot. The following code
//--------------- h.cc ------------------
#include < list >
class a
{
int x, y;
public:
a(int x, int y) : x(x), y(y) { }
};
int main()
{
list< a > b;
b.push_back(a(1,2));
}
//---------------------------------------
causes egcs to complain:
#----------------------------------------
egcs/include/g++-2/stl_construct.h: In function `void construct<a>(class a *)':
egcs/include/g++-2/stl_list.h:303: instantiated from `list<a,allocator<a> >::_M_create_node()'
egcs/include/g++-2/stl_list.h:344: instantiated from `list<a,allocator<a> >::insert(_List_iterator<a,a &,a *>, const a &)'
egcs/include/g++-2/stl_list.h:381: instantiated from `list<a,allocator<a> >::push_back(const a &)'
h.cc:14: instantiated from here
egcs/include/g++-2/stl_construct.h:53: no matching function for call to `a::a ()'
h.cc:8: candidates are: a::a(const a &)
h.cc:7: a::a(int, int)
#----------------------------------------
In the instantiation traceback, it is claimed that _M_create_node()
is called at line 344 of stl_list.h, but that is not true. It is
_M_create_node(const _Tp &) which is called there. Somehow, gcc is
deciding to instantiate the wrong function.
More information about the Gcc-bugs
mailing list