[Issue 1523] New: struct literals not work with typedef

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 20 23:04:41 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1523

           Summary: struct literals not work with typedef
           Product: DGCC aka GDC
           Version: 0.24
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn at users.sf.net
        ReportedBy: pop.atry at gmail.com


struct BaseStruct {
  int n;
  char c;
}

typedef BaseStruct MyStruct;

void myFunction(MyStruct) {}

int main() {
  myFunction(MyStruct(0, 'x'));
  return 0;
}

***********************************************
$ gdc typedef_struct_literals.d
typedef_struct_literals.d:11: function typedef_struct_literals.myFunction
(MyStruct) does not match parameter types (BaseStruct )
typedef_struct_literals.d:11: Error: cannot implicitly convert expression
(BaseStruct(0,'x')) of type BaseStruct to MyStruct


-- 



More information about the D.gnu mailing list