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



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



This has been a regression since at least 2.063.2. git bisect shows that the
bad commit was:

0275c56cbaa09d6ec49e978bd011eb5b0a9b62aa


    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




 This has been a regression since at least 2.063.2. git bisect shows that the
 bad commit was:
 
 0275c56cbaa09d6ec49e978bd011eb5b0a9b62aa

 
     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




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


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