www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2969] New: ICE on const declaration

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

           Summary: ICE on const declaration
           Product: D
           Version: 2.030
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: mikolalysenko gmail.com


Try compiling following snippet:

module sound;

import std.math;

struct Sound
{
    float time;
    float delegate(float) func;

    this(float delegate(float) f, float t)
    {
        time = t;
        func = f;
    }

    Sound opAdd(const(Sound) other)
    {
        return Sound(
        (float t){
            return func(t) + other.func(t);
        }, fmax(time, other.time));
    }

    Sound opCat(const(Sound) other)
    {
        return Sound(
        (float t){
            if(t <= time)
                return func(t);
            return other.func(t - time);
        }, time + other.time);
    }

}


Gives the error message:
Internal error: ../ztc/cod4.c 353

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 12 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2969


Gide Nwawudu <gide nwawudu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |gide nwawudu.com
            Version|2.030                       |2.029
         OS/Version|Linux                       |All





Shorter version.

struct Sound {
    int delegate(int) func;

    this(int delegate(int) f) {
    }

    Sound opAdd(const(Sound) other)
    {
        return Sound(
        (int t){
            return other.func(0);
        });
    }

}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 13 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2969


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au





This _might_ be a duplicate of 2560 or 2875.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 13 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2969


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE(cod4.c) on const        |ICE(cod4.c) using const
                   |declaration                 |function parameter inside
                   |                            |delegate





Even shorter test case:

struct S {
    int q;
}

void foo(const(S) x) {
   int delegate(int t) bar = (int t){ return 1 + x.q; };
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 05 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2969


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE





This is another duplicate of 2560. Worked in 2.022.

*** This issue has been marked as a duplicate of issue 2560 ***

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