Bug 12295 – wrongly accepts ctor with optional parameter

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-03T15:43:00Z
Last change time
2014-03-04T02:59:32Z
Assigned to
nobody
Creator
timothee.cour2

Comments

Comment #0 by timothee.cour2 — 2014-03-03T15:43:28Z
D20140303T153856 struct A{ int x; this(int x=10){this.x=x;} //Shouldn't allow this as we can't have parameter-less ctors } void main(){ auto a=A(); assert(a.x==10); //FAILS }
Comment #1 by andrej.mitrovich — 2014-03-04T02:59:32Z
*** This issue has been marked as a duplicate of issue 3438 ***