[PATCH] Remove 'explicit' keyword from constructors with multiple (non-default) arguments.

Alexander Kornienko alexfh at google.com
Mon Jun 23 04:47:18 PDT 2014


+Matt, who requested this feature.

On Sun, Jun 22, 2014 at 9:13 AM, James Dennett <jdennett at googlers.com>
wrote:

> On Sun, Jun 22, 2014 at 3:00 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> Fwiw, if I'm not mistaken, explicit on more - than - one - arg actors does
>> have some meaning in c++11. It means you can't construct from a braced
>> init
>> list.
>>
>
> IIRC: More specifically, you can't use copy-list-initialization; direct
> initialization from a braced init list is allowed for an explicit
> constructor.
>
> The essence is that it takes some thought before removing explicit from a
> constructor, more so than in C++98.
>

Thanks for noting. This may be an interesting argument in whether we should
remove "explicit" on multiple-argument constructors or not. I'm not sure
though, how useful the ability to disallow direct initialization from a
braced init list is. It's rather obvious what harm can an implicit call to
a single-argument constructor cause, but with braced init lists a mistake
is much less likely, imo.

Matt, what do you think about this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140623/b4c1a30e/attachment.html>


More information about the cfe-commits mailing list