[Issue 11615] Syntax to indicate auto return type is const

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 20 10:13:40 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=11615

Basile-z <b2.temp at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |b2.temp at gmx.com
         Resolution|---                         |WORKSFORME

--- Comment #2 from Basile-z <b2.temp at gmx.com> ---
I think this ER is nowadays invalid. 
You can use the `const` STC alone, which is like the `const auto` you wanted.

struct Foo
{
    int[] _arr = [0, 1, 2, 3, 4];

    const arr() @property
    {
        return _arr;
    }

    pragma(msg, typeof(arr())); // const(int[])
}

--


More information about the Digitalmars-d-bugs mailing list