D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6246 - Struct instance parameterized with an Integral fails as argument to functions/methods
Summary: Struct instance parameterized with an Integral fails as argument to functions...
Status: RESOLVED DUPLICATE of issue 3467
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All Linux
: P2 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-03 22:30 UTC by Puneet Goel
Modified: 2012-04-24 18:01 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Puneet Goel 2011-07-03 22:30:15 UTC
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 SomeDude 2012-04-24 12:08:35 UTC
Compiles and runs with 23059 Win32
Comment 2 Kenji Hara 2012-04-24 18:01:52 UTC

*** This issue has been marked as a duplicate of issue 3467 ***