www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6801] New: access violation when passing a function literal to the mixin and calling it from function that has other declarations

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

           Summary: access violation when passing a function literal to
                    the mixin and calling it from function that has other
                    declarations
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: luka8088 owave.net



// this happens on Windows XP, 32bit, any version between dmd2-042 and dmd2-055
// there was also a feedback that linux dmd2-055 causes segfault

// workaround for this is to use -O when compiling (both or windows and linux)

import std.stdio;

mixin template tpl1 (alias fn) {

  void b () {
    // calling fn causes Access Violation if there is two or more int
declarations
    // in order to make this work either remove one int declaration or remove
fn call
    int c;
    int d;
    fn();
  }

}

class a {
  mixin tpl1!(function () { writeln("test"); });
}

void main () {
  a a1 = new a();
  a1.b();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 10 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6801


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com



PDT ---
Also fails with 2.059 Win32

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