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


--- Comment #0 from Henning Pohl <henning still-hidden.de> 2013-05-27 14:13:55
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


--- Comment #1 from Henning Pohl <henning still-hidden.de> 2013-05-27 14:16:55
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



--- Comment #2 from github-bugzilla puremagic.com 2013-05-27 15:25:47 PDT ---
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
Merge pull request #2087 from hpohl/10186

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                       |


--- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2013-05-27 15:44:56 PDT ---
(In reply to comment #1)
 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



--- Comment #4 from github-bugzilla puremagic.com 2013-06-01 13:53:10 PDT ---
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
Merge pull request #2090 from hpohl/10186

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                       |


--- Comment #5 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2013-06-03
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


--- Comment #6 from Max Samukha <samukha voliacable.com> 2013-10-08 10:59:20
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



--- Comment #7 from Kenji Hara <k.hara.pg gmail.com> 2013-10-11 07:06:48 PDT ---
(In reply to comment #5)
 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



--- Comment #8 from Kenji Hara <k.hara.pg gmail.com> 2013-10-11 07:08:46 PDT ---
(In reply to comment #6)
 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