Date
2016-08-15.00:00:00
Message id
8307

Content

[ 2016-08-02, Chicago: Walt, Nevin, Rob, and Hal provide revised wording ]

Previous resolution [SUPERSEDED]:

This wording is relative to N4606.

This also resolves the first part of LWG 2460
  1. In Table 46 — "Other transformations" edit the entry for common_type:

    Table 46 — Other transformations
    Template Comments
    template <class... T>
    struct common_type;
    The member typedef type shall be defined or omitted as specified below.
    If it is omitted, there shall be no member type. All types in the
    parameter pack T shall be complete or (possibly cv) void.
    A program may specialize this trait for two cv-unqualified non-reference types
    if at least one template parameter in the specializationof them
    is a user-defined type. [Note: Such specializations are
    needed when only explicit conversions are desired among the template
    arguments. — end note]
  2. Edit [meta.trans.other] p3 (and its subbullets) as shown below

    For the common_type trait applied to a parameter pack T of types, the member type shall be either defined or not present as follows:

    • If sizeof...(T) is zero, there shall be no member type.

    • If sizeof...(T) is one, let T0 denote the sole type in the pack T. The member typedef type shall denote the same type as decay_t<T0>.

    • If sizeof...(T) is two, let T1 and T2, respectively, denote the first and second types comprising T, and let D1 and D2, respectively, denote decay_t<T1> and decay_t<T2>.

      • If is_same_v<T1, D1> and is_same_v<T2, D2>, and if there is no specialization common_type<T1, T2>, let C denote the type, if any, of an unevaluated conditional expression ([expr.cond]) whose first operand is an arbitrary value of type bool, whose second operand is an xvalue of type D1, and whose third operand is an xvalue of type D2. If there is such a type C, the member typedef type shall denote C. Otherwise, there shall be no member type.

      • If not is_same_v<T1, D1> or not is_same_v<T2, D2>, the member typedef type shall denote the same type, if any, as common_type_t<D1, D2>. Otherwise, there shall be no member type.

    • If sizeof...(T) is greater than onetwo, let T1, T2, and R, respectively, denote the first, second, and (pack of) remaining types comprising T. [Note: sizeof...(R) may be zero. — end note] Let C denote the type, if any, of an unevaluated conditional expression ([expr.cond]) whose first operand is an arbitrary value of type bool, whose second operand is an xvalue of type T1, and whose third operand is an xvalue of type T2. Let C denote common_type_t<T1, T2>. If there is such a type C, the member typedef type shall denote the same type, if any, as common_type_t<C, R...>. Otherwise, there shall be no member type.