https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104996

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
For the record, the full rejects-valid testcase is:

// #g.1: rvalue reference function parameter
constexpr bool g(int&&)       { return true; }

// #g.2: const lvalue reference function parameter
constexpr bool g(int const&)  { return false; }

static_assert(g(0), ""); // OK: all compilers agree

// #f.1: rvalue ref overload
template<int size>
constexpr bool f(int (&&)[size])      { return true; }

// #f.2: lvalue ref overload
template<int size>
constexpr bool f(int const (&)[size]) { return false; }

template<typename T>
using type = T;

static_assert(f(type<int[3]>{1, 2, 3})); // OK: all compilers agree.

static_assert(f({1, 2, 3}), ""); // Clang: OK    (picks #f.1)
                                 // MSVC:  OK    (picks #f.1)
                                 // GCC:   Error (picks #f.2)

Reply via email to