Bug 10583 – DMD 2.063 dumps core with mixins involving __traits(getProtection, ..

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-09T10:21:00Z
Last change time
2013-07-20T17:24:26Z
Keywords
ice, pull
Assigned to
nobody
Creator
puneet

Comments

Comment #0 by puneet — 2013-07-09T10:21:03Z
Here is the test code. On compiling I get: dmd: traits.c:288: virtual Expression* TraitsExp::semantic(Scope*): Assertion `protName' failed. Aborted (core dumped) Also note that if I uncomment line 37 and comment out line 36, dmd compiles the code smoothly. ///////////// Test Code starts here enum sync; // 1 // 2 public template get_sync(size_t I, A...) { // 3 static if(I == A.length) // 4 enum bool get_sync = false; // 5 else static if(is(A[I] == sync)) // 6 enum bool get_sync = true; // 7 else // 8 enum bool get_sync = get_sync!(I+1, A); // 9 } // 10 // 11 template add_sync(T, size_t ITER=0) { // 12 static if(ITER == (__traits(derivedMembers, T).length)) { // 13 enum string add_sync = ""; // 14 } else { // 15 enum string mem = __traits(derivedMembers, T)[ITER]; // 16 enum string add_sync = // 17 "mixin(add_sync!(get_sync!(0, __traits(getAttributes, " // 18 ~ mem ~ ")), __traits(getProtection, " // 19 ~ mem ~ "), \"" ~ mem ~ "\")); " ~ add_sync!(T, ITER+1); // 20 } // 21 } // 22 // 23 template add_sync(bool A, string P, string M) { // 24 static if(A) { // 25 enum string add_sync = " auto " ~ M[1..$] ~ // 26 "() {synchronized(this) return " ~ M ~ ";}"; // 27 } else { // 28 enum string add_sync = ""; // 29 } // 30 } // 31 // 32 class derived { // 33 mixin(add_sync!(derived)); // 34 @sync private bool _bar; // 35 void frop() {} // 36 // private void frop() {} // 37 } // 38
Comment #1 by k.hara.pg — 2013-07-19T02:49:03Z
Comment #2 by github-bugzilla — 2013-07-20T17:23:59Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8437f1993cd1924e423cddcda45d83fdb41f0a96 fix Issue 10583 - DMD 2.063 dumps core with mixins involving __traits(getProtection) https://github.com/D-Programming-Language/dmd/commit/671b7c20b96b580ee1dc2b3f5e3ee66c63d079b6 Merge pull request #2362 from 9rnsr/fix10583 Issue 10583 - DMD 2.063 dumps core with mixins involving __traits(getProtection)