www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8436] New: ICE: Internal error: toir.c 178

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

           Summary: ICE: Internal error: toir.c 178
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: deadalnix gmail.com



I got the issue mentionned in the title, with the following piece of code (I
didn't succeed in reducing it further).

auto dispatch(
    alias unhandled = {
    }, V, T
)(V visitor, ref T t) {
        return t;
}

class Type {
}

class BuiltinType(T) : Type {
}

Type getPromotedType(Type t2) {

    class T2Handler(T) {
        Type visit(Type t) {
            return this.dispatch!(t => new BuiltinType!T)(t);
        }
    }

    class T1Handler {
        Type visit(Type t) {
            return (t => handleBuiltinType!int)(t);
        }

        auto handleBuiltinType(T)() {
            return (new T2Handler!T).visit(t2);
        }

        Type visit() {
            return handleBuiltinType!uint;
        }
    }

    return (new T1Handler).visit;
}

I have no clue what precisely cause the error.

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



11:43:19 PDT ---
It's related to failing to detect that one is calling a nested function from a
context where the context pointer to that nested function cannot be generated.

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





 It's related to failing to detect that one is calling a nested function from a
 context where the context pointer to that nested function cannot be generated.
I don't think so. I solved the issue in the real codebase by using (Type t){ return new BuiltinType!T(); } instead of t => new BuiltinType!T() And the same for all reduced delegate syntax. It seems that the problem shows up when the delegate is templated (necessary but not sufficient). I discovered that later, so it isn't in the original bug report. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8436




13:02:54 PDT ---
Knowing that it is related to the template version is helpful.

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE: Internal error: toir.c |ICE(toir.c 178)
                   |178                         |



probably a duplicate of one of the other ICE(toir.c) bugs. bug4504, bug5902,
bug6426, etc.

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


Walter Bright <bugzilla digitalmars.com> changed:

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



18:07:10 PDT ---
This compiles successfully with 2.064 head.

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