<div>Greetings All</div><div><br></div><div>I have a Struct (see minimized code below) which is failing for a simple assignment. I am using DMD 2.053, and am getting an error:</div><div><br></div><div>> implicit.d(14): Error: cannot implicitly convert expression (foo1) of type Foo!(4) to Foo!(NN)</div>
<div><br></div><div>Am I doing something wrong, or have I hit a DMD bug? Kindly note that this happens only when I parameterize the struct using an Integral parameter, and works file when using string as parameter (as with struct Bar in the code).</div>
<div><br></div><div>Regards</div><div>- Puneet</div><div><br></div><div>// File implicit.d</div><div>struct Foo (size_t N) {</div><div> void opAssign (size_t NN)(Foo!(NN) f) {/*do nothing*/}</div><div>}</div><div>struct Bar (string S) {</div>
<div> void opAssign (string SS)(Bar!(SS) f) {/*do nothing*/}</div><div>}</div><div>void main() {</div><div> Bar!"BAR1" bar1;</div><div> Bar!"BAR2" bar2;</div><div> bar2 = bar1;<span style="white-space:pre-wrap"> </span>// this compiles fine</div>
<div> Foo!4 foo1;</div><div> Foo!4 foo2;</div><div> foo2 = foo1;<span style="white-space:pre-wrap"> </span>// compilation error</div><div>}</div><div><br></div>