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]
Other format: [Raw text]

[Bug c++/18975] Copying objects with mutable non-static data members


------- Additional Comments From nathan at gcc dot gnu dot org  2004-12-14 13:57 -------
The code is invalid and the compiler correct.

The following line of reasoning is incorrect
- The implicitly defined copy constructor should use the copy constructor of
  PTR (12.8/8). Since the member ptr of XYZ is MUTABLE the (public) copy
  constructor PTR::PTR (PTR&) should be called after overload resolution:
  "PTR::PTR (PTR&)" is a better match than "PTR::PTR (const PTR&)".

[7.1.1/9] is unclear about *when* the mutable storage class specifier
'nullifies a const specifier applied to the containing class'.  However,
it has always been my understanding (and edg 3.4 appears to agree), that
the mutable applies at the point of assignment, not before, such as at
overload resolution.  After all, overload resolution has no knowledge that
an assignment will actually occur to the const value.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18975


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