<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>Allow initializing aggregates from a parenthesized list of values</title>

	<style>
	p {text-align:justify}
	li {text-align:justify}
	blockquote.note
	{
		background-color:#E0E0E0;
		padding-left: 15px;
		padding-right: 15px;
		padding-top: 1px;
		padding-bottom: 1px;
	}
	ins {color:#00A000}
	del {color:#A00000}
	</style>
</head>
<body>

<address align=right>
Document number: P0960R1
<br/>
Audience: EWG
<br/>
<br/>
<a href="mailto:ville.voutilainen@gmail.com">Ville Voutilainen</a><br/>
2018-05-02<br/>
</address>
<hr/>
<h1 align=center>Allow initializing aggregates from a parenthesized list of values</h1>

<h2>Abstract</h2>
<p>
  This paper proposes allowing initializing aggregates from
  a parenthesized list of values; that is, Aggr(val1, val2)
  would mean the same thing as Aggr{val1, val2}. This is a language
  fix for the problem illustrated in
  <a href="http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/n4462.html">N4462</a>.
</p>

<h2>Revision history</h2>

<p>
  <ul>
    <li>P0960R0 - initial version</li>
    <li>P0960R1 - this version, wording created based on EWG
      feedback from Jacksonville 2018</li>
  </ul>
</p>

<h2>Jacksonville 2018 discussion feedback</h2>

<p>
  <ul>
  <li>Do we want more work in the direction depicted in p0960r0? 12 | 11 | 7 | 1 | 1</li>
  <li>Restrict the change to just dependent types? 1 | 1 | 2 | 13 | 14</li>
  <li>Should designated initializers be supported? 1 | 3 | 12 | 11 | 3</li>
  <li>Should raw arrays be supported? 4 | 14 | 11 | 2 | 1</li>
  <li>Incorporate ban brace-initializing an object if it would be plausible that it would use a deleted constructor? 11 | 14 | 5 | 0 | 3</li>
  </ul>
</p>

<p>
  This revision implements supporting parenthesized initialization
  for aggregates including arrays, without support for designated initializers.
  The matter of initialization and deleted constructors is handled
  by separate paper(s).
</p>

<h2>Design principles</h2>

<ul>
  <li>Any existing meaning of A(b) should not change.</li>
  <li>Parenthesized initialization and braced-initialization should
    be as similar as possible.</li>
  <ul>
    <li>One difference remains: for an aggregate A,
      A{b} will not convert b to A, unless
      b is of type A or type derived from A. A(b) will convert even
      in other cases. This difference applies only to aggregates.</li>
  </ul>
</ul>
<h2>Wording</h2>

<p>
  In [dcl.init]/17, edit as follows:
</p>
<p>
  <blockquote>
    <del>Otherwise, if the destination type is an array, the program is ill-formed.</del>
  </blockquote>
</p>
<p>
  In [dcl.init]/17.6.2, edit as follows:
  <blockquote>
    Otherwise, if the initialization is direct-initialization, or
    if it is copy-initialization where the cv-unqualified version of the
    source type is the same class as, or a derived class of, the class of the
    destination, constructors are considered. The applicable constructors
    are enumerated (16.3.1.3), and the best one is chosen through overload
    resolution (16.3). The constructor so selected is called
    to initialize the object, with the initializer expression or
    expression-list as its argument(s). If no constructor applies
    <ins>and the destination type is not an aggregate</ins>,
    or the overload resolution is ambiguous, the initialization is ill-formed.

  </blockquote>
</p>
<p>
  After [dcl.init]/17.6.3 and before [dcl.init]/17.7, insert a new
  top-level bullet as follows:
</p>
  <blockquote>
    <ins>If the destination type is an aggregate and the initialization
      is direct-initialization and no viable constructor was found
      above (17.6.2), the object is list-initialized as if the
      initializer was a (non-parenthesized) braced-init-list containing
      the expression-list. [Note: designators are not permitted. -end note]
      </ins>
  </blockquote>
</p>
<p>
  Drafting note: the note in the above wording can easily be left out - the
  grammar of a parenthesized initialization does not allow designators.
  The note is added just for explanatory clarity.
</p>

</body>

</html>
