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.
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.
Note for editor: The following changes apply to 20.7.2[variant.variant]:
Types...
shall be (possibly cv-qualified) object types that are not arrays , (possibly cv-qualified) void, or references. [ Note: Implementations could decide to store references in a wrapper. — end note ]
¶3: A program that instantiates the definition of variant
with no template arguments is ill-formed.
Note for editor: The following changes apply to 20.7.4[variant.get]:
I < sizeof...(Types)
, and TI
is not (possibly cv-qualified) void
. Otherwise the program is ill-formed.T
occurs exactly once in Types...
, and T
is not (possibly cv-qualified) void
. Otherwise, the program is ill-formed.I < sizeof...(Types)
, and TI
is not (possibly cv-qualified) void
. Otherwise the program is ill-formed.T
occurs exactly once in Types...
, and T
is not (possibly cv-qualified) void
. Otherwise, the program is ill-formed.Revision 0:
[N4606] C++17 CD Ballot Document. Available online at www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf.
[P0488R0] National Body Comments Available online at http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0488r0.pdf.