Thread overview
[Issue 8436] New: ICE: Internal error: toir.c 178
Jul 25, 2012
deadalnix
Jul 25, 2012
Walter Bright
Jul 25, 2012
deadalnix
Jul 25, 2012
Walter Bright
[Issue 8436] ICE(toir.c 178)
Nov 13, 2012
Don
Oct 04, 2013
Walter Bright
July 25, 2012
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


--- Comment #0 from deadalnix <deadalnix@gmail.com> 2012-07-25 07:48:32 PDT ---
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: -------
July 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8436


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2012-07-25 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: -------
July 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8436



--- Comment #2 from deadalnix <deadalnix@gmail.com> 2012-07-25 11:51:09 PDT ---
(In reply to comment #1)
> 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: -------
July 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8436



--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2012-07-25 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: -------
November 13, 2012
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                         |


--- Comment #4 from Don <clugdbug@yahoo.com.au> 2012-11-13 11:37:38 PST ---
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: -------
October 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8436


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2013-10-03 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: -------