[Issue 6246] New: Struct instance parameterized with an Integral fails as argument to functions/methods

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 3 22:35:16 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6246

           Summary: Struct instance parameterized with an Integral fails
                    as argument to functions/methods
           Product: D
           Version: D2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: puneet at coverify.org


--- Comment #0 from Puneet Goel <puneet at coverify.org> 2011-07-03 22:30:15 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list