[Issue 12295] New: wrongly accepts ctor with optional parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 3 15:43:31 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12295

           Summary: wrongly accepts ctor with optional parameter
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: timothee.cour2 at gmail.com


--- Comment #0 from Timothee Cour <timothee.cour2 at gmail.com> 2014-03-03 15:43:28 PST ---
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
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list