This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of TS status.

2733. [fund.ts.v2] gcd / lcm and bool

Section: 13.1.2 [fund.ts.v2::numeric.ops.gcd], 13.1.3 [fund.ts.v2::numeric.ops.lcm] Status: TS Submitter: Richard Smith Opened: 2016-06-15 Last modified: 2017-07-30

Priority: 4

View all other issues in [fund.ts.v2::numeric.ops.gcd].

View all issues with TS status.

Discussion:

Addresses: fund.ts.v2

According to N4562, gcd and lcm support bool as the operand type. The wording doesn't appear to cover the behavior for that case, since bool does not have a zero value and gcd / lcm are not normally mathematically defined over {false, true}.

Presumably gcd and lcm shouldn't accept arguments of type bool.

[2016-08-01, Walter Brown suggests wording]

A corresponding issue has been added addressing the WP, see LWG 2759.

[2016-08, Chicago]

Monday PM: Moved to Tentatively Ready

Proposed resolution:

This wording is relative to N4600.

  1. Adjust 13.1.2 [fund.ts.v2::numeric.ops.gcd] p3 as indicated:

    template<class M, class N>
      constexpr common_type_t<M, N> gcd(M m, N n);
    

    […]

    -3- Remarks: If either M or N is not an integer type, or if either is (possibly cv-qualified) bool, the program is ill-formed.

  2. Adjust 13.1.3 [fund.ts.v2::numeric.ops.lcm] p3 as indicated:

    template<class M, class N>
      constexpr common_type_t<M, N> lcm(M m, N n);
    

    […]

    -3- Remarks: If either M or N is not an integer type, or if either is (possibly cv-qualified) bool, the program is ill-formed.