View mode: basic / threaded / horizontal-split · Log in · Help
March 24, 2012
[Issue 7757] New: Inout function with lazy inout parameter doesn't compile
http://d.puremagic.com/issues/show_bug.cgi?id=7757

          Summary: Inout function with lazy inout parameter doesn't
                   compile
          Product: D
          Version: D2
         Platform: All
       OS/Version: All
           Status: NEW
         Severity: critical
         Priority: P2
        Component: DMD
       AssignedTo: nobody@puremagic.com
       ReportedBy: hsteoh@quickfur.ath.cx


--- Comment #0 from hsteoh@quickfur.ath.cx 2012-03-23 19:04:06 PDT ---
Code:

inout(int) func(int x, lazy inout(int) defaultVal) {
       return defaultVal;
}

void main() {
       int x = func(1,2);
       const(int) cx = func(1,2);
}

Compiler error:

test2.d(4): Error: inout on return means inout must be on a parameter as well
for pure @safe inout(int)()
test2.d(8): Error: inout on return means inout must be on a parameter as well
for inout(int)()
test2.d(9): Error: inout on return means inout must be on a parameter as well
for inout(int)()

Clearly, this is wrong, because inout *is* on the second parameter. It's being
masked by the "lazy", as can be proven by removing "lazy" and it will compile.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 24, 2012
[Issue 7757] Inout function with lazy inout parameter doesn't compile
http://d.puremagic.com/issues/show_bug.cgi?id=7757


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

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


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-03-24 12:08:31 PDT ---
https://github.com/D-Programming-Language/dmd/pull/836

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 27, 2012
[Issue 7757] Inout function with lazy inout parameter doesn't compile
http://d.puremagic.com/issues/show_bug.cgi?id=7757



--- Comment #2 from github-bugzilla@puremagic.com 2012-03-26 21:00:55 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/e74a26ad05629d72d353552ef144ac69c3e9994a
Merge pull request #836 from 9rnsr/fix7757

Issue 7757 - Inout function with lazy inout parameter doesn't compile

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 27, 2012
[Issue 7757] Inout function with lazy inout parameter doesn't compile
http://d.puremagic.com/issues/show_bug.cgi?id=7757


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: -------
January 22, 2013
[Issue 7757] Inout function with lazy inout parameter doesn't compile
http://d.puremagic.com/issues/show_bug.cgi?id=7757



--- Comment #3 from github-bugzilla@puremagic.com 2013-01-22 09:44:19 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/406ad56b97f44002a452bdaa202639f339d00165
Need more hack for bug 7757

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home