Bug 6246 – Struct instance parameterized with an Integral fails as argument to functions/methods

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2011-07-03T22:30:00Z
Last change time
2012-04-24T18:01:52Z
Assigned to
nobody
Creator
puneet

Comments

Comment #0 by puneet — 2011-07-03T22:30:15Z
struct Foo (size_t N) { void opAssign (size_t NN)(Foo!(NN) f) {/*do nothing*/} } struct Bar (string S) { void opAssign (string SS)(Bar!(SS) f) {/*do nothing*/} } void main() { Bar!"BAR1" bar1; Bar!"BAR2" bar2; bar2 = bar1; // this compiles fine Foo!4 foo1; Foo!4 foo2; foo2 = foo1; // compilation error } Gives an error saying: Error: cannot implicitly convert expression (foo1) of type Foo!(4) to Foo!(NN) Structs with string parameters work just fine.
Comment #1 by lovelydear — 2012-04-24T12:08:35Z
Compiles and runs with 23059 Win32
Comment #2 by k.hara.pg — 2012-04-24T18:01:52Z
*** This issue has been marked as a duplicate of issue 3467 ***