Your monthly ICE report
Klaus-Georg Adams
Klaus-Georg.Adams@chemie.uni-karlsruhe.de
Mon Nov 23 05:26:00 GMT 1998
Hi Carlo,
if your real problem is this:
// This should be called as copy constructor, right???
template<class Y>
lockable_auto_ptr(const lockable_auto_ptr<Y> &) {
cerr << "Called template<class Y> lockable_auto_ptr(const lockable_auto_ptr<Y> &)" << endl;
}
template<class Y>
lockable_auto_ptr& operator=(const lockable_auto_ptr<Y> &) {
cerr << "Called template<class Y> lockable_auto_ptr& operator=(const lockable_auto_ptr<Y> &)" << endl;
return *this;
}
then your code is broken: [class.copy], clause 3:
...A member function template is never instantiated to perform the
copy of a class object to an object of its class type.
and clause 9: A user-declared copy assignment operator X::operator= is
a non-static non-template member function of class X ...
This means you use the implicitely defined Copyctor, which is a Bad
Thing for auto_ptr :-)
-- kga
-------------------------------------------------------------------------
Klaus-Georg Adams Email: Klaus-Georg.Adams@chemie.uni-karlsruhe.de
Institut f. Anorg. Chemie, Lehrstuhl II Tel: 49(0)721 608 3485
Universität Karlsruhe, D-76128 Karlsruhe
-------------------------------------------------------------------------
More information about the Gcc-bugs
mailing list