[Issue 10577] New: 2.063 Mixin Regression (works with 2.062)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 8 18:32:50 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10577
Summary: 2.063 Mixin Regression (works with 2.062)
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: regression
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: puneet at coverify.org
--- Comment #0 from Puneet Goel <puneet at coverify.org> 2013-07-08 18:32:49 PDT ---
Here is the minimal code to reproduce.
Works with version 2.062. With version 2.063 and latest github snapshot, I get
an error:
test.d(37): Error: function test.derived.foo multiple overrides of same
function
// 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 = "";
}
}
class base {
public void foo() {}
}
class derived : base {
mixin(add_sync!(derived));
@sync private bool _bar;
public override void foo() {}
}
--
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