Bug 3001 – Templated types within a mixin not reinstantiated properly for new instantiation
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2009-05-17T11:08:00Z
Last change time
2014-04-18T09:12:04Z
Keywords
rejects-valid
Assigned to
nobody
Creator
matti.niemenmaa+dbugzilla
Comments
Comment #0 by matti.niemenmaa+dbugzilla — 2009-05-17T11:08:34Z
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).
Comment #1 by matti.niemenmaa+dbugzilla — 2009-06-11T09:32:40Z
I'm bumping this to 'blocker' because it's preventing me from using DMD for my project.
Comment #2 by clugdbug — 2009-09-16T04:22:59Z
This worked on 1.010, but did not work in 1.020. Bumping up to regression.