www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6905] New: ref acts as auto ref when return type is missing

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

           Summary: ref acts as auto ref when return type is missing
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



11:17:13 PST ---
struct Foo
{
    int x;

    ref noReturnType()
    {
        return x;
    }
}

void main()
{
    auto foo = Foo();
    foo.noReturnType = 5;
    assert(foo.x == 5);
}

Should this be allowed? It doesn't make much sense, especially when you can
write code like this:

struct Foo
{
    ref noReturnType()
    {
        return 1;  // does an rvalue return
    }
}

void main()
{
    auto foo = Foo();
    auto x = foo.noReturnType();
}

This compiles and only confuses the reader.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 07 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6905


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com
           Platform|Other                       |All
         OS/Version|Windows                     |All



This happens because there is no actual storage class for auto ref, it just
becomes auto ref when it is both auto and ref.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6905


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



https://github.com/D-Programming-Language/dmd/pull/1401
https://github.com/D-Programming-Language/phobos/pull/1028

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 24 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6905




Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/2bbb33df2fa9f87ae73de6924031e1a854756ea1
Additional fix for issue 6905

For the inference of return value ref-ness, we should use 'auto ref' instead of
'ref' or 'const ref'

https://github.com/D-Programming-Language/phobos/commit/03a6e295fadd7c563a60069be0be3ada1c234666


Additional fix for issue 6905

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 24 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6905




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/251885197ac9470c65807f739ea49cdc983c5a3e
fix Issue 6905 - ref acts as auto ref when return type is missing

https://github.com/D-Programming-Language/dmd/commit/f193abd3a39759f432197ba9f37e48518fb4499a


Issue 6905 - ref acts as auto ref when return type is missing

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 08 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6905


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 08 2013