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.
Comment #2 by b2.temp — 2019-12-12T02:31:57Z
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.
Comment #3 by razvan.nitu1305 — 2022-11-16T15:38:05Z
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.