Thread overview
[Issue 2969] New: ICE on const declaration
May 13, 2009
Gide Nwawudu
May 13, 2009
Don
[Issue 2969] ICE(cod4.c) using const function parameter inside delegate
Aug 05, 2009
Don
Aug 31, 2009
Don
May 13, 2009
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 13, 2009
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




--- Comment #1 from Gide Nwawudu <gide@nwawudu.com>  2009-05-13 02:24:57 PDT ---
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
http://d.puremagic.com/issues/show_bug.cgi?id=2969


Don <clugdbug@yahoo.com.au> changed:

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




--- Comment #2 from Don <clugdbug@yahoo.com.au>  2009-05-13 11:19:45 PDT ---
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: -------
August 05, 2009
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




--- Comment #3 from Don <clugdbug@yahoo.com.au>  2009-08-05 00:15:43 PDT ---
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: -------
August 31, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2969


Don <clugdbug@yahoo.com.au> changed:

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




--- Comment #4 from Don <clugdbug@yahoo.com.au>  2009-08-31 02:25:02 PDT ---
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: -------