Thread overview
[Issue 17222] assert in compiler caused by opDispatch
Dec 12, 2019
Basile-z
Dec 12, 2019
Basile-z
Mar 21, 2020
Basile-z
Nov 16, 2022
RazvanN
December 12, 2019
https://issues.dlang.org/show_bug.cgi?id=17222

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice
                 CC|                            |b2.temp@gmx.com

--- Comment #1 from Basile-z <b2.temp@gmx.com> ---
reduced a bit more:

---
template AliasSeq() {  }

template Proxy(alias a)
{
    template opDispatch(string name, T...)
    {
        alias Dummy = AliasSeq!(mixin("a."~name~"!(T)"));
    }
}

class Foo
{
    T ifti1(T)(T) { }
}

static class Hoge
{
    Foo foo;
    mixin Proxy!foo;
}

void main()
{
    Hoge.ifti1;
}
---

The problem seems to be that there's an attempt to alias an expression but the error does not prevent the semantic of:

  alias Dummy = AliasSeq!(mixin("a."~name~"!(T)"));

to stop early because we're in a opDispatch which is infamously known for the problems it creates by ignoring errors.

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

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch

--- Comment #2 from Basile-z <b2.temp@gmx.com> ---
patch:

---
diff --git a/src/dmd/dinterpret.d b/src/dmd/dinterpret.d index 28911bc19..22ea4927e 100644
--- a/src/dmd/dinterpret.d
+++ b/src/dmd/dinterpret.d
@@ -80,9 +80,9 @@ public Expression ctfeInterpret(Expression e)
             break;
     }

-    assert(e.type); // https://issues.dlang.org/show_bug.cgi?id=14642
-    //assert(e.type.ty != Terror);    // FIXME
-    if (e.type.ty == Terror)
+    // https://issues.dlang.org/show_bug.cgi?id=14642
+    // https://issues.dlang.org/show_bug.cgi?id=17222
+    if (e.type && e.type.ty == Terror)
---

It seems that the assertion on the expression type is not relevant anymore. In the present case, the exp has not type and is a "dotTemplateInstance", for which the InterpreterClass don't access the type.

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=17222

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--
November 16, 2022
https://issues.dlang.org/show_bug.cgi?id=17222

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |WORKSFORME

--- Comment #3 from RazvanN <razvan.nitu1305@gmail.com> ---
This now yields:

test.d-mixin-10(10): Error: template instance `ifti1!()` does not match
template declaration `ifti1(T)(T)`
test.d(27): Error: template instance
`test.__unittest_L15_C1.Hoge.Proxy!(foo).opDispatch!"ifti1".opDispatch!()`
error instantiating
test.d(27): Error: `opDispatch(T...)` has no effect

Closing as worksforme.

--