Thread overview
[Issue 8335] New: DMD ignoring ref for array arguments
Jul 02, 2012
Puneet Goel
[Issue 8335] `ref` is ignored for static array of stucts with postblit argument
Jul 02, 2012
Denis Shelomovskij
Jul 02, 2012
Kenji Hara
Jul 02, 2012
Kenji Hara
Jul 02, 2012
Kenji Hara
Jul 22, 2012
Walter Bright
July 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8335

           Summary: DMD ignoring ref for array arguments
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: puneet@coverify.org


--- Comment #0 from Puneet Goel <puneet@coverify.org> 2012-07-02 03:39:35 PDT ---
I am testing with the latest pull from github and dmd ignoring "ref" when passing array as ref argument. Kindly see the code below. When I run this code it prints "Postblit called!" four time.

//
struct Foo {
  this(this) {
    import std.stdio;
    writeln("Postblit called!");
  }
}

void barArray(ref Foo[4] _f) { /*do nothing*/ }

void main() {
  Foo [4] fooArray;
  barArray(fooArray);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8335


Denis Shelomovskij <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |verylonglogin.reg@gmail.com
            Summary|DMD ignoring ref for array  |`ref` is ignored for static
                   |arguments                   |array of stucts with
                   |                            |postblit argument
           Severity|normal                      |regression


--- Comment #1 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2012-07-02 15:03:40 MSD ---
Another testcase:
---
struct S
{
    int i;
    version(trigger_assert_in_main)
        // `@disable` will just be ignored
        // and postblit will not be called.
        // Looks like because of Issue 7579.
        @disable this(this);
    else
        this(this) { assert(0); }
}

void f(ref S[3] arr)
{
    arr[0].i = 7;
}

void main() {
    S[3] arr;
    f(arr);
    assert(arr[0].i == 7);
}
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8335



--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-07-02 08:58:44 PDT ---
This is definitely a bug, but is really *regression*?
I'd like to know the version of dmd which had worked correctly.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8335



--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2012-07-02 09:27:18 PDT ---
(In reply to comment #2)
> This is definitely a bug, but is really *regression*?
> I'd like to know the version of dmd which had worked correctly.

Ah, OK. I found the reason of this bug, and this is a regression of 2.060head (Does not occurs in 2.059).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8335


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

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


--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2012-07-02 09:51:05 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1035

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8335



--- Comment #5 from github-bugzilla@puremagic.com 2012-07-22 14:17:24 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/4ce0f83b388982f6fef550b5c4829acfe744e4f7
fix Issue 8335 - `ref` is ignored for static array of stucts with postblit
argument

https://github.com/D-Programming-Language/dmd/commit/146442eb5d63c8ec88968122e2238cd607f2ecbb Merge pull request #1035 from 9rnsr/fix8335

Issue 8335 - `ref` is ignored for static array of stucts with postblit argument

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8335


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: -------