[Issue 2647] New: typedef's and struct constructors
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 6 00:25:37 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2647
Summary: typedef's and struct constructors
Product: D
Version: 2.023
Platform: PC
OS/Version: All
Status: NEW
Keywords: spec
Severity: minor
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: s.d.hammett at googlemail.com
when using typedefs of structs
their constructors return the original type instead of the new type
struct Ca {
this(int a) {
_answer = a / 2;
}
int _answer;
}
void testClasses() {
typedef Ca Da;
Ca a = Ca(84);
Da c = Da(84);
}
tests0.d(38):
Error: cannot implicitly convert expression (((Ca __ctmp276 = __ctmp276 = 0;
) , __ctmp276).this(84)) of type Ca to Da
A cast is required for the code to work.
--
More information about the Digitalmars-d-bugs
mailing list