www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10630] New: Structs with disabled default construction can't be used as `out` parameters

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

           Summary: Structs with disabled default construction can't be
                    used as `out` parameters
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2013-07-13
19:27:41 MSD ---
---
struct S
{  disable this(); }

void f(out S) { } // no errors here

void main()
{
    S s = S.init;
    f(s); // Error: struct main.S default construction is disabled
}
---

As disabled default construction may be also interpreded as "not for `out`
parameters" (and yes, it breaks the code) it is absolutely inconsistent that
the error is in function usage but not in the declaration.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 13 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10630


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh quickfur.ath.cx


--- Comment #1 from hsteoh quickfur.ath.cx 2013-08-30 11:22:21 PDT ---
This has been a regression since at least 2.063.2. git bisect shows that the
bad commit was:

0275c56cbaa09d6ec49e978bd011eb5b0a9b62aa
    Merge pull request #2052 from 9rnsr/fix10115

    Issue 10115 - More  disabled holes

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, pull
           Severity|regression                  |major


--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2013-09-01 18:53:16 PDT ---
(In reply to comment #1)
 This has been a regression since at least 2.063.2. git bisect shows that the
 bad commit was:
 
 0275c56cbaa09d6ec49e978bd011eb5b0a9b62aa
     Merge pull request #2052 from 9rnsr/fix10115
 
     Issue 10115 - More  disabled holes
This is not a true regression, because the combination of out parameter + disabled default construction struct is essentially invalid. http://dlang.org/function#parameters "parameter is initialized upon function entry with the default value for its type" Such struct does not have "default value", because its construction always needs explicit constructor call with one or more arguments. From 2.063, such function call was made invalid, but the declaration is still accepted. Therefore this issue should be marked an "accepts-invalid". Compiler fix: https://github.com/D-Programming-Language/dmd/pull/2510 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 01 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10630



--- Comment #3 from github-bugzilla puremagic.com 2013-09-15 00:16:36 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/6cb33db03031a48e5767072271f02d271dd21f28
fix Issue 10630 - Structs with disabled default construction can't be used as
`out` parameters

https://github.com/D-Programming-Language/dmd/commit/2b7b591296f63fdd344dd545a7b41ff53fa5b4ca
Merge pull request #2510 from 9rnsr/fix10630

Issue 10630 - Structs with disabled default construction can't be used as `out`
parameters

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


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: -------
Sep 15 2013