Strange Error using parameterized opAssign for a struct
d coder
dlang.coder at gmail.com
Mon Jul 4 02:58:45 PDT 2011
Greetings All
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:
> implicit.d(14): Error: cannot implicitly convert expression (foo1) of type
Foo!(4) to Foo!(NN)
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).
Regards
- Puneet
// File implicit.d
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
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110704/16c0b2c1/attachment.html>
More information about the Digitalmars-d
mailing list