Topic: Defect Report: Allowed copy constructor signatures


Author: "Richard Smith" <richard@ex-parrot.com>
Date: 08 Jan 02 10:55:01 GMT
Raw View
 [Moderator's note: this defect report has been
 forwarded to the C++ committee. -moderator.]

Section 12.1 [class.ctor]

12.1 [class.ctor] paragraph 10 states

    A copy constructor for a class X is a constructor with a
    first parameter of type X & or of type const X &.  [Note:
    see 12.8 for more information on copy constructors.]

No mention is made of constructors with first parameters of types volatile X
& or const volatile X &.  This statement seems to be in contradiction with
12.8 [class.copy] paragraph 2 which states

    A non-template constructor for class X is a copy constructor
    if its first parameter is of type X &, const X &, volatile X &
    or const volatile X &, ...

12.8 [class.copy] paragraph 5 also mentions the volatile versions of the
copy constructor, and the comparable paragraphs for copy assignment (12.8
[class.copy] paragraphs 9 and 10) all allow volatile versions, so it seems
that 12.1 [class.ctor] is at fault.

Suggested resolution:

Change the wording of 12.1 [class.ctor] paragraph 10 to

    A copy constructor for a class X is a constructor with a
    first parameter of type X &, const X &, volatile X & or
    const volatile X &.  [Note: see 12.8 for more information
    on copy constructors.]

--
Richard Smith
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]