[Issue 3001] New: Templated types within a mixin not reinstantiated properly for new instantiation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun May 17 11:08:35 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3001
Summary: Templated types within a mixin not reinstantiated
properly for new instantiation
Product: D
Version: 1.043
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: matti.niemenmaa+dbugzilla at iki.fi
Tricky to summarize. The following doesn't compile:
========
struct TemplateStruct(int x) {}
template T() {
struct S { TemplateStruct!(x) t; }
void foo() {
TemplateStruct!(x) t;
S s;
s.t = t;
}
}
class Super(int x) { mixin T!(); }
void main() {
Super!(1) a;
Super!(2) b;
}
========
Errors:
arst.d(11): Error: cannot implicitly convert expression (t) of type
TemplateStruct!(2) to TemplateStruct!(1)
arst.d(19): Error: template instance arst.Super!(2) error instantiating
The TemplateStruct in S seems to be referring to the first instantiation of
Super in both instantiations, although the type should be different.
Passing x to T makes it work. This also works in LDC, but not DMD (tried 1.043
and 1.045).
--
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