Article View: comp.std.c++
Article #1912Re: Explicit-keyword and default constructors
From: Nathan Myers
Date: Tue, 05 Sep 1995 21:06
Date: Tue, 05 Sep 1995 21:06
37 lines
1620 bytes
1620 bytes
In article <42gjou$1m9@proffa.cc.tut.fi>,
Pulkkinen Esa <p150651@proffa.cc.tut.fi> wrote:
>class A
>{
>public:
> explicit A() {}
>};
>A a; // Legal? (IMHO: no) [yes]
>A b=A(); // OK, as always
>A c(); // OK, c is a function returning A :)
>
>class B : public A {}
>// Default constructor generated, and calls A()? Legal?
>// (IMHO: no) ... [yes]
>My analysis:
>[dcl.fct.spec]/5 states: ...
>[class.conv.ctor]/1: ...
>
>These were the only places I could find, where the semantics of
>the explicit specifier was explained.
Esa has called attention to an embarrassment: the April '95 Draft
doesn't actually specify *any* semantics for "explicit", because
it defines "nonconverting constructor" but never uses the term.
Steve's explanation of the intent is accurate, though. The omission
is considered "editorial", which means fixing it doesn't require a
committee vote.
Nathan Myers
myersn@roguewave.com
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<MATT.95Sep5140605@physics12.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!128.32.155.1!mattReferences:
<42gjou$1m9@proffa.cc.tut.fi>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt From: ncm@netcom.com (Nathan Myers) Newsgroups: comp.std.c++ Subject: Re: Explicit-keyword and default constructors Date: 05 Sep 1995 21:06:05 GMT Organization: NETCOM On-line Communication Services (408 261-4700 guest) Approved: matt@physics12.Berkeley.EDU (Matt Austern) Message-ID: <MATT.95Sep5140605@physics12.Berkeley.EDU> References: <42gjou$1m9@proffa.cc.tut.fi> NNTP-Posting-Host: physics12.berkeley.edu