<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
		<title>Disallowing references, incomplete types, arrays, and Empty Variants</title>
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<meta http-equiv="Content-Language" content="en-us">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

		<style type="text/css">
			.addition { color: green; text-decoration: underline; }
			.right { float:right; }
			.desc { margin-left: 35px; margin-top: 10px; padding:0; white-space: normal; }
			.changed-deleted { color: red; background-color: #CFF0FC ; text-decoration: line-through; }
			.addition.changed-deleted { color: green; background-color: #CFF0FC; text-decoration: line-through; text-decoration: black double line-through;}
			.changed-added { background-color: #CFF0FC ;}
			body {max-width: 1024px; margin-left: 25px;}
			.cppkeyword { color: blue;font:courier new; }
			.cppcomment { color: green; }
			.cppcomment > .cppkeyword{ color: green; }
			.cpptext { color: #2E8B57; }
		</style>
	</head>


	<body bgcolor="#ffffff">
		<address>Document number: P0510R0</address>
		<address>Project: Programming Language C++</address>
		<address>Audience: Library Working Group</address>
		<address>&nbsp;</address>
		<address>Erich Keane &lt;<a href="mailto:erich.keane@intel.com">erich.keane@intel.com</a>&gt;</address>
		<address>&nbsp;</address>
		<address>Date: 2016-11-10</address>
		<h1>Disallowing references, incomplete types, arrays, and empty variants</h1>

		<h2>I. Introduction and Motivation</h2>
        <p>National Body Comments [P0488R0] US112, US115, US116, US117, US120, US181, FI22, CH3 (the second), CH4, CH5, CH6, and CH8 point out issues with having variant permit empty parameter packs, void parameters, arrays, and reference parameters. Library Evolution Working Group decided to disallow these four conditions.</p>

		<h2>II. Impact on the Standard</h2>
		<p>This proposal alters the wording for variant, limiting its scope.  Implementers with existing implementations would be required to modify their implementation to disallow references, incomplete types, and empty variants.
		</p>

		<h2>III. Proposed wording relative to the Working Draft N4606.</h2>
		<p><b>Note for editor:</b> The following changes apply to 20.7.2[variant.variant]:</p>
        <div style="white-space:word-wrap;">
         <span><b>¶2:</b> All types in <code>Types...</code> shall be (possibly cv-qualified) object types<span class=addition> that are not arrays</span> <span class=changed-deleted>, (possibly cv-qualified) void, or references</span>.<span class=changed-deleted> [ Note: Implementations could decide to store references in a wrapper. — end note ]</span></span>
         </br>
         <span class=addition><b>¶3:</b> A program that instantiates the definition of <code>variant</code> with no template arguments is ill-formed.</span>
        </div>
		<p><b>Note for editor:</b> The following changes apply to 20.7.4[variant.get]:</p>
        <div style="white-space:word-wrap;">
        <span><b>¶3:</b>Requires:<code>I &lt; sizeof...(Types)</code><span class=changed-deleted>, and <code>T<sub>I</sub></code> is not (possibly cv-qualified) <code>void</code></span>. Otherwise the program is ill-formed.</span><br/>
        <span><b>¶5:</b>Requires: The type <code>T</code> occurs exactly once in <code>Types...</code><span class=changed-deleted>, and <code>T</code> is not (possibly cv-qualified) <code>void</code></span>. Otherwise, the program is ill-formed.</span><br/>
        <span><b>¶7:</b>Requires:<code>I &lt; sizeof...(Types)</code><span class=changed-deleted>, and <code>T<sub>I</sub></code> is not (possibly cv-qualified) <code>void</code></span>. Otherwise the program is ill-formed.</span><br/>
        <span><b>¶9:</b>Requires: The type <code>T</code> occurs exactly once in <code>Types...</code><span class=changed-deleted>, and <code>T</code> is not (possibly cv-qualified) <code>void</code></span>. Otherwise, the program is ill-formed.</span><br/>
        </div>
        </div>
		<h2>IV. Revision History</h2>
		<p>Revision 0:</p>
		<ul>
			<li>
				Initial proposal.
			</li>
		</ul>


		<h2>V. References</h2>
		<p>[<a name="N4606">N4606</a>] C++17 CD Ballot Document. Available online at
					<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf">www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf</a>.</p>
		<p>[<a name="P0488R0">P0488R0</a>] National Body Comments
			Available online at <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0488r0.pdf">
				http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0488r0.pdf</a>.
			</p>
		<p>&nbsp;</p>

</body></html>
