www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11632] New: Old alias syntax accepts "ref"

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11632

           Summary: Old alias syntax accepts "ref"
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: public dicebot.lv


--- Comment #0 from Dicebot <public dicebot.lv> 2013-11-28 07:29:22 PST ---
When using old alias form, `ref` is both accepted and not making any effect:

-----------
alias ref int RefInt;

void foo(RefInt x)
{
    x = 42;
}

void main()
{
    int x;
    foo(x);

    import std.stdio : writeln;
    writeln(x);
}
-----------
0
-----------

`alias RefInt = ref int` is rejected with "Error: basic type expected, not ref"
so I assume it should be the same here.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 28 2013
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11632


Maxim Fomin <maxim maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim maxim-fomin.ru


--- Comment #1 from Maxim Fomin <maxim maxim-fomin.ru> 2013-11-28 07:46:39 PST
---
More nonsense:

alias ref int ri;
//alias in int ii;
alias int oi;
//alias lazy int li;
//alias out int outi;

alias pure int pi;
alias  safe int si;
//alias trusted int ti;
alias nothrow int nthi;

alias auto int ai;
alias  property int pri;
alias  disable int di;
alias scope int sci;

alias align(16) int ali;

alias abstract int absi;

alias final int fi;
alias override int ovi;
alias inout int inoui;
alias synchronized int syi;

alias static int stati;

It is unclear however, whether this is a part of major accepts-invalid bug (dmd
is permissive in allowing to apply attributes to declarations, so here is
particular case) or defficiency in old alias syntax parsing.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 28 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11632



--- Comment #2 from Dicebot <public dicebot.lv> 2013-11-28 07:52:06 PST ---
Whatever it is, current behavior is extremely confusing for newbies as one may
expect it to actually work in example like provided in the first post.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 28 2013
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11632


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #3 from bearophile_hugs eml.cc 2013-11-28 08:02:54 PST ---
See also Issue 3934

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 28 2013