Thread overview
[Issue 24869] Qualifier dropped from return type when AliasSeq is indexed with template argument
3 days ago
Nick Treleaven
3 days ago
Nick Treleaven
3 days ago
Nick Treleaven
3 days ago
https://issues.dlang.org/show_bug.cgi?id=24869

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #1 from Nick Treleaven <nick@geany.org> ---
Reduced:

struct S
{
    int n;
    ref int get() const => n;
}

void main()
{
    const S s;
    s.get;
}

--
3 days ago
https://issues.dlang.org/show_bug.cgi?id=24869

--- Comment #2 from Nick Treleaven <nick@geany.org> ---
>     ref int get() const => n;

Sorry, you're right, ignore comment 1. That should be `ref const(int)`.

It's weird as the function prototype type is OK:

    ref const(AliasSeq!(int)[0]) g() const;
    pragma(msg, typeof(g)); // const ref const(int)()

--
3 days ago
https://issues.dlang.org/show_bug.cgi?id=24869

--- Comment #3 from Nick Treleaven <nick@geany.org> ---
OK, making the prototype a template again shows the wrong return type:

    ref const(AliasSeq!(int)[i]) get(size_t i)() const;
    pragma(msg, typeof(get!0)); // const ref int()

--