This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-10-26


1683. Incorrect example after constexpr changes

Section: 7.7  [expr.const]     Status: CD4     Submitter: Daniel Krügler     Date: 2013-05-15

The example in 7.7 [expr.const] paragraph 6,

  struct A {
    constexpr A(int i) : val(i) { }
    constexpr operator int() { return val; }
    constexpr operator long() { return 43; }
  private:
    int val;
  };
  template<int> struct X { };
  constexpr A a = 42;
  X<a> x;               // OK: unique conversion to int
  int ary[a];           // error: ambiguous conversion

is no longer correct now that constexpr does not imply const for member functions, since the conversion functions cannot be invoked for the constant a.

Notes from the September, 2013 meeting:

This issue is being handled editorially and is being placed in "review" status to ensure that the change has been made.