www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10583] New: DMD 2.063 dumps core with mixins involving __traits(getProtection, ..

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10583

           Summary: DMD 2.063 dumps core with mixins involving
                    __traits(getProtection, ..
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: puneet coverify.org


--- Comment #0 from Puneet Goel <puneet coverify.org> 2013-07-09 10:21:03 PDT
---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 09 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10583


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice, pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-07-19 02:49:03 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2362

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10583



--- Comment #2 from github-bugzilla puremagic.com 2013-07-20 17:23:59 PDT ---
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)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 20 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10583


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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