www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10186] New: default construction is disabled even if default ctor declared

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

           Summary: default construction is disabled even if default ctor
                    declared
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: henning still-hidden.de



PDT ---
struct S {
     disable this();

    this(int i) {
    }
}

class C {
    this() {
        s = S(1);
    }

    S s;
}

void main() {
    auto c = new C;
}

-----
main.d(17): Error: default construction is disabled for type C
-----

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


Henning Pohl <henning still-hidden.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid



PDT ---
https://github.com/D-Programming-Language/dmd/pull/2087

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




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

https://github.com/D-Programming-Language/dmd/commit/4c138e35e8fab9b5d035ba385d0ba54dc2b7124e
fix issue 10186 - default construction is disabled even if default ctor
declared

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


fix issue 10186 - default construction is disabled even if default ctor
declared

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


Andrei Alexandrescu <andrei erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrei erdani.com
         Resolution|                            |FIXED


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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |




 https://github.com/D-Programming-Language/dmd/pull/2087
The fix is incomplete. struct S { disable this(); this(int i) {} } class C { S s; // move definition before the ctor this() { s = S(1); } } void main() { auto c = new C; // line 16 } test.d(16): Error: default construction is disabled for type C -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 27 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10186




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

https://github.com/D-Programming-Language/dmd/commit/def98cd111ad81043413dcbf799f9edc66fc656b
fix issue 10186

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


fix issue 10186

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |verylonglogin.reg gmail.com
         Resolution|FIXED                       |



10:18:19 MSD ---
What about `this(int = 0)` class constructor?

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


Max Samukha <samukha voliacable.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |samukha voliacable.com



PDT ---
And, with v2.064-devel-64d739f, C.s is still assigned from a temporary object
instead of being constructed directly. That defeats the purpose of " disable
this", because assignment assumes that the target object has been properly
constructed. And, in the presence of " disable this", "set to init" does not
qualify for "properly constructed".

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





 What about `this(int = 0)` class constructor?
https://github.com/D-Programming-Language/dmd/pull/2655 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 11 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10186





 And, with v2.064-devel-64d739f, C.s is still assigned from a temporary object
 instead of being constructed directly. That defeats the purpose of " disable
 this", because assignment assumes that the target object has been properly
 constructed. And, in the presence of " disable this", "set to init" does not
 qualify for "properly constructed".
The issue has been already filed in bug 9665. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 11 2013