[Issue 9739] Regression (2.063 git-head): DMD not considering ctor with default args as default ctor
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Apr 3 18:27:12 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9739
--- Comment #2 from Kenji Hara <k.hara.pg at 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: -------
More information about the Digitalmars-d-bugs
mailing list