Thread overview
[Issue 8262] ICE(mtype.c) alias this to alias of an expression tuple
Nov 28, 2014
Rainer Schuetze
Dec 06, 2014
Rainer Schuetze
July 17, 2014
https://issues.dlang.org/show_bug.cgi?id=8262

hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh@quickfur.ath.cx
           Severity|normal                      |critical

--- Comment #2 from hsteoh@quickfur.ath.cx ---
Wow. This *still* doesn't work on git HEAD: dmd now segfaults.

--
July 17, 2014
https://issues.dlang.org/show_bug.cgi?id=8262

--- Comment #3 from hsteoh@quickfur.ath.cx ---
Stack trace:
#0  0x0000000000410199 in TypeStruct::implicitConvTo(Type*) ()
#1  0x00000000004c8213 in IsExp::semantic(Scope*) ()
#2  0x00000000004de990 in AndAndExp::semantic(Scope*) ()
#3  0x00000000004de924 in AndAndExp::semantic(Scope*) ()
#4  0x00000000004de924 in AndAndExp::semantic(Scope*) ()
#5  0x00000000004de924 in AndAndExp::semantic(Scope*) ()
#6  0x00000000004b4769 in StaticIfCondition::include(Scope*, ScopeDsymbol*) ()
#7  0x000000000043d637 in ConditionalStatement::flatten(Scope*) ()
#8  0x00000000004437d1 in CompoundStatement::semantic(Scope*) ()
#9  0x00000000004ede13 in FuncDeclaration::semantic3(Scope*) ()
#10 0x00000000004504c4 in TemplateInstance::semantic3(Scope*) ()
#11 0x0000000000454d83 in TemplateInstance::trySemantic3(Scope*) ()
#12 0x000000000045c2e3 in TemplateInstance::semantic(Scope*,
Array<Expression*>*) [clone .part.63] ()
#13 0x000000000045c87f in functionResolve(Match*, Dsymbol*, Loc, Scope*,
Array<RootObject*>*, Type*, Array<Expression*>*) ()
#14 0x00000000004ec05e in resolveFuncCall(Loc, Scope*, Dsymbol*,
Array<RootObject*>*, Type*, Array<Expression*>*, int) ()
#15 0x00000000004d3c33 in CallExp::semantic(Scope*) [clone .part.134] ()
#16 0x000000000043fd9b in ExpStatement::semantic(Scope*) ()
#17 0x0000000000443b6a in CompoundStatement::semantic(Scope*) ()
#18 0x00000000004ede13 in FuncDeclaration::semantic3(Scope*) ()
#19 0x0000000000407a50 in Module::semantic3() ()
#20 0x000000000040526c in tryMain(unsigned long, char const**) ()
#21 0x00007ffff7015b45 in __libc_start_main (main=0x402490 <main>, argc=2,
argv=0x7fffffffeb68,
    init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
stack_end=0x7fffffffeb58)
    at libc-start.c:287
#22 0x00000000004029c5 in _start ()

--
July 17, 2014
https://issues.dlang.org/show_bug.cgi?id=8262

--- Comment #4 from hsteoh@quickfur.ath.cx ---
Cause of segfault: aliasthisOf() returned NULL to implicitConvTo().

--
July 17, 2014
https://issues.dlang.org/show_bug.cgi?id=8262

--- Comment #5 from hsteoh@quickfur.ath.cx ---
And the reason is because aliasthisOf() does not expect a TypeTuple; it expects a variable declaration, a function, an enum, or a template. Normally, TypeTuples cannot appear in an alias this due to the current grammar, but there is a loophole where they can be masked by another layer of alias, as in the code given here, so it leads into this unhandled case.

--
September 25, 2014
https://issues.dlang.org/show_bug.cgi?id=8262

hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #6 from hsteoh@quickfur.ath.cx ---
https://github.com/D-Programming-Language/dmd/pull/4025

--
November 28, 2014
https://issues.dlang.org/show_bug.cgi?id=8262

Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario@gmx.de

--- Comment #7 from Rainer Schuetze <r.sagitario@gmx.de> ---
Here's another example of a crash at the same location reduced by dustmite:

struct Tuple9709(T...)
{
    alias T expand;
    alias expand this;
}

auto data = RTInfoImpl2!(Tuple9709!1);

template RTInfoImpl2(T)
{
    static if (is(T D == U))
        immutable(RTInfoData) RTInfoImpl2 ;
}

[this is also triggered by some RTInfo compiled with the dmd test suite.]

There are some code locations that check the pointer returned by aliasthisOf(), some do not. Should these be added in the places where the checks are missing?

--
December 06, 2014
https://issues.dlang.org/show_bug.cgi?id=8262

--- Comment #8 from Rainer Schuetze <r.sagitario@gmx.de> ---
https://github.com/D-Programming-Language/dmd/pull/4195

avoids the crash, but doesn't add implicite conversion for tuples.

--
December 12, 2017
https://issues.dlang.org/show_bug.cgi?id=8262

--- Comment #9 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/2f27c59732481880545ca65a4641806087cc23e7 fix issue 8262 -  ICE(mtype.c) alias this to alias of an expression tuple

check return of aliasthisOf

https://github.com/dlang/dmd/commit/4616d4485102fc4650d14d185e224a621c25d965 Merge pull request #4195 from rainers/aliasthisof

Issue 8262 -  ICE(mtype.c) alias this to alias of an expression tuple merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>

--
December 12, 2017
https://issues.dlang.org/show_bug.cgi?id=8262

github-bugzilla@puremagic.com changed:

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

--
December 18, 2017
https://issues.dlang.org/show_bug.cgi?id=8262

--- Comment #10 from github-bugzilla@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/2f27c59732481880545ca65a4641806087cc23e7 fix issue 8262 -  ICE(mtype.c) alias this to alias of an expression tuple

https://github.com/dlang/dmd/commit/4616d4485102fc4650d14d185e224a621c25d965 Merge pull request #4195 from rainers/aliasthisof

--