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

Mital Ashok <mital at mitalashok dot co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mital at mitalashok dot co.uk

--- Comment #3 from Mital Ashok <mital at mitalashok dot co.uk> ---
Bisected to r15-6744-gc6b54302df470bf09801ad6785d5713ef23dcb38

It does only happen when initializing a type alias, `constexpr auto other_zero
= zero ;` and `constexpr decltype(nullptr) other_zero = zero ;` do compile.

Standard references: <https://wg21.link/conv.lval#3.1>,
<https://wg21.link/expr.const#9.9.1>

The note talks about inactive union members and volatile objects, so should add
some extra tests too:

    using nullptr_t = decltype(nullptr);
    constexpr nullptr_t cst = nullptr;
    constexpr union u {
        constexpr u() : active(1) {}
        int active;
        nullptr_t inactive;
    } x;
    extern nullptr_t ext;
    // volatile nullptr_t vol = nullptr;

    constexpr nullptr_t a = cst;
    constexpr nullptr_t b = x.inactive;
    constexpr nullptr_t c = ext;
    // constexpr nullptr_t d = vol;

The volatile one is commented out because that appears to be an unrelated bug
(also didn't work in GCC 14)

Reply via email to