[Issue 7780] Template mixin'd members do not properly overload

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 19 01:15:28 PDT 2012


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


Shire <degener_trash at mail.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |degener_trash at mail.ru


--- Comment #1 from Shire <degener_trash at mail.ru> 2012-05-19 01:16:59 PDT ---
Also trivial methods hides mixin overloads:

static struct A {
  // to generate a lot of repeating overloads
  // mixin will be good
  mixin template _bind(T, string S) {
    string bind(T var) { return S; }
  }
  mixin _bind!(short, "Short");
  mixin _bind!(int, "Int");
  string bind(long var) { return "Long"; }
  string bind(double var) { return "Double"; }
}

A a;
short s; int i; long l; double d;
string all = a.bind(s) ~ a.bind(i) ~ a.bind(l) ~ a.bind(d);
assert(all == "ShortIntLongDouble"); // fail with "LongLongLongDouble"
// mixin scopes is invisible for bind() overloading

-- 
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