STL requiring default constructors

Maurizio Vitale Maurizio.Vitale@esat.kuleuven.ac.be
Thu Oct 1 04:13:00 GMT 1998


Sorry if this has already been reported but with:
gcc version egcs-2.92.11 19980923 (gcc2 ss-980609 experimental)

the following code:

#include <list>

class T {
public:
  T(int i) : _i(i) {}
private:
  int _i;
};

std::list<T> l;

int
main()
{
  l.push_back (T(1));
}

is not compiled by GCC (it complains about a missing default constructor).
I haven't found such a requirement anywhere in the standard and KAI C++
(based on the EDG front end) compiles the above fragment without
complaining.
Thanks,

	Maurizio Vitale



More information about the Gcc-bugs mailing list