Jump to page: 1 2
Thread overview
[Issue 9739] New: DMD not considering ctor with default args as default ctor
Mar 17, 2013
Puneet Goel
Mar 17, 2013
Andrej Mitrovic
[Issue 9739] Regression (2.063 git-head): DMD not considering ctor with default args as default ctor
Apr 04, 2013
Kenji Hara
Apr 04, 2013
Kenji Hara
Apr 04, 2013
Walter Bright
Apr 12, 2013
Andrej Mitrovic
Apr 12, 2013
Leandro Lucarella
[Issue 9739] Regression (1.077 git-head): DMD not considering ctor with default args as default ctor
Apr 12, 2013
Leandro Lucarella
Apr 12, 2013
Leandro Lucarella
Apr 12, 2013
Leandro Lucarella
Apr 13, 2013
Walter Bright
March 17, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9739

           Summary: DMD not considering ctor with default args as default
                    ctor
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: puneet@coverify.org


--- Comment #0 from Puneet Goel <puneet@coverify.org> 2013-03-16 20:06:54 PDT ---
Compiles with 2.062. But with the latest github snapshot, gives me an error:

$ rdmd --force test.d
test.d(5): Error: class test.Bar Cannot implicitly generate a default ctor when
base class test.Foo is missing a default ctor
Failed: 'dmd' '-v' '-o-' 'test.d' '-I.'


class Foo {
  this(int arg=0) { }
}

class Bar: Foo { }

void main() {
  Bar test = new Bar;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 17, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9739


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com,
                   |                            |k.hara.pg@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-03-16 20:46:04 PDT ---
This is caused by: https://github.com/D-Programming-Language/dmd/pull/1439

I think I've already tried to change how the 'defaultCtor' field is set, but I think that change got rejected, or maybe it was part of a pull that wasn't yet merged.

In hindsight I should have written more elaborate tests.

@Kenji: Do you know why the code which sets `ad->defaultCtor = this;` doesn't check for defaulted parameters? That code is at the end of `CtorDeclaration::semantic`

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9739



--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-04-03 18:27:10 PDT ---
(In reply to comment #1)
> This is caused by: https://github.com/D-Programming-Language/dmd/pull/1439
> 
> I think I've already tried to change how the 'defaultCtor' field is set, but I think that change got rejected, or maybe it was part of a pull that wasn't yet merged.
> 
> In hindsight I should have written more elaborate tests.
> 
> @Kenji: Do you know why the code which sets `ad->defaultCtor = this;` doesn't check for defaulted parameters? That code is at the end of `CtorDeclaration::semantic`

Because ad->defaultCtor should not have any parameters. Its function pointer will be stored in TypeInfo_Class.defaultConstructor, so storing `this(int arg=0)` in it would cause access violation in runtime.

https://github.com/D-Programming-Language/druntime/blob/master/src/object_.d#L853 https://github.com/D-Programming-Language/dmd/blob/master/src/toobj.c#L585

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9739


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

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


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2013-04-03 19:22:21 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1833

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9739



--- Comment #4 from github-bugzilla@puremagic.com 2013-04-03 21:47:58 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/7ab0211e68815663cf84aa0cf98425f0f6e4bade fix Issue 9739 - DMD not considering ctor with default args as default ctor

https://github.com/D-Programming-Language/dmd/commit/8a2a36894eecb96f32eee7db377308e277791032 Merge pull request #1833 from 9rnsr/fix9739

[REG2.063a] Issue 9739 - DMD not considering ctor with default args as default ctor

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9739


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: -------
April 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9739


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |leandro.lucarella@sociomant
                   |                            |ic.com


--- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-04-12 08:49:18 PDT ---
*** Issue 9925 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9739


Leandro Lucarella <leandro.lucarella@sociomantic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
            Version|D2                          |D1
         Resolution|FIXED                       |


--- Comment #6 from Leandro Lucarella <leandro.lucarella@sociomantic.com> 2013-04-12 08:53:30 PDT ---
This is still present in D1.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9739



--- Comment #7 from Leandro Lucarella <leandro.lucarella@sociomantic.com> 2013-04-12 08:59:47 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1892

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9739



--- Comment #8 from Leandro Lucarella <leandro.lucarella@sociomantic.com> 2013-04-12 09:04:06 PDT ---
(In reply to comment #7)
> https://github.com/D-Programming-Language/dmd/pull/1892

Nope, doesn't work, it was a literal backport of D2 fix but D1 doesn't have resolveFuncCall(). So I guess something else needs to be done. Would probably be even better to revert the change that caused it in D1 if a better solution is hard to implement (see issue 9925).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
« First   ‹ Prev
1 2