This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Your monthly ICE report


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
-------------------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]