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


Puneet Goel <pun...@coverify.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |


--- Comment #5 from Puneet Goel <pun...@coverify.org> 2013-07-12 10:30:43 PDT 
---
Slightly different test case. But since this too is related, I am re-opening
the same bug. Let me know if I should instead be opening a separate bug for
this.

With this code, I am getting a *spurious* deprecation warning (compiles without
warning with version 2.062).

test.d(37): Deprecation: class test.derived use of test.base.foo() hidden by
derived is deprecated. Use 'alias base.foo foo;' to introduce base class
overload set.

// test.d Code starts here
enum sync;

public template get_sync(size_t I, A...) {
  static if(I == A.length)           enum bool get_sync = false;
  else static if(is(A[I] == sync))   enum bool get_sync = true;
    else                             enum bool get_sync = get_sync!(I+1, A);
}

template add_sync(T, size_t ITER=0) {
  static if(ITER == (__traits(derivedMembers, T).length)) {
    enum string add_sync = "";
  } else {
    enum string mem = __traits(derivedMembers, T)[ITER];
    enum string add_sync =
      "static if(! __traits(isVirtualMethod, " ~ mem ~ ")) {" ~
      "mixin(add_sync!(get_sync!(0, __traits(getAttributes, "
      ~ mem ~ ")), \"" ~ mem ~ "\"));} " ~ add_sync!(T, ITER+1);
  }
}

template add_sync(bool A, string M) {
  static if(A) {
    enum string add_sync = " auto " ~ M[1..$] ~
      "() {synchronized(this) return " ~ M ~ ";}";
  } else {
    enum string add_sync = "";
  }
}

abstract class base {
  mixin(add_sync!(base));
  @sync private bool _bar;
  public void foo();
}

class derived: base {
  public override void foo() {}
}

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

Reply via email to