Thread overview
[Issue 20945] alias x = ref y compiles
Jun 17, 2020
Stanislav Blinov
Jun 18, 2020
Boris Carvajal
Jun 18, 2020
Stanislav Blinov
Jun 18, 2020
Stanislav Blinov
Jun 18, 2020
Stanislav Blinov
Dec 17, 2022
Iain Buclaw
June 17, 2020
https://issues.dlang.org/show_bug.cgi?id=20945

Stanislav Blinov <stanislav.blinov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid

--
June 18, 2020
https://issues.dlang.org/show_bug.cgi?id=20945

Boris Carvajal <boris2.9@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |boris2.9@gmail.com

--- Comment #1 from Boris Carvajal <boris2.9@gmail.com> ---
There's one usage of this in Phobos even though it doesn't work.

std/range/package.d
----------------------------
// This doesn't work yet
static if (allSameType)
{
    alias ElementType = ref RvalueElementType;
}
else
{
----------------------------

--
June 18, 2020
https://issues.dlang.org/show_bug.cgi?id=20945

--- Comment #2 from Stanislav Blinov <stanislav.blinov@gmail.com> ---
...and that's been there since 2009

https://github.com/dlang/phobos/commit/e486c557bcb590b54bd414718c30c09fa6536e63

I'm almost tempted to make a PR that would add a "and never will" to that comment.

--
June 18, 2020
https://issues.dlang.org/show_bug.cgi?id=20945

--- Comment #3 from Stanislav Blinov <stanislav.blinov@gmail.com> ---
All of these compile:

alias st = static int;
alias au = auto int;
alias sc = scope int;
alias ov = override int;
alias ab = abstract int;
alias sy = synchronized int;
alias nt = nothrow int;
alias pu = pure int;
alias re = ref int;

And none of them should, ideally with a message such as:

`ref` is not allowed in `alias` declaration.

(Currently, `out` and `lazy` don't compile, but the message is not that succinct, as it falls through multiple parsing attemts).

--
June 18, 2020
https://issues.dlang.org/show_bug.cgi?id=20945

--- Comment #4 from Stanislav Blinov <stanislav.blinov@gmail.com> ---
...and then there's the whole old syntax of

alias static int si;
alias auto int au;
alias scope int sc;
alias override int ov;
alias abstract int ab;
alias synchronized int sy;
alias nothrow int nt;
alias pure int pu;
alias ref int re;
alias __gshared int gs;

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=20945

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 13
https://issues.dlang.org/show_bug.cgi?id=20945

--- Comment #5 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19722

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--