dmd/compiler/test/fail_compilation/b23686.d
SixthDot 26f706a9dd
fix issue 23686 - TemplateAliasParam default value possibly considered equal in different instances (#15679)
The default arg might depend on another TemplateParameter,
in which case it is required to copy the AST, otherwise
different instances of the template might be falsy considered equal.
2023-10-14 17:18:06 +08:00

42 lines
889 B
D

/*
TEST_OUTPUT:
---
fail_compilation/b23686.d(107): Error: undefined identifier `eFN1`, did you mean template `eFN0()()`?
fail_compilation/b23686.d(107): Error: `mixin(_error_)` does not give a valid type
fail_compilation/b23686.d(115): while looking for match for `eload!(int, 1)`
fail_compilation/b23686.d(121): Error: undefined identifier `FNwtf`
fail_compilation/b23686.d(121): Error: `mixin(_error_)` does not give a valid type
fail_compilation/b23686.d(126): while looking for match for `load!"wtf"`
---
*/
module b23686;
#line 100
//-------------------
void eFN0()()
{
}
void eload(I, I name, alias T = mixin("eFN" ~ name.stringof))()
{
T!()();
}
void test2()
{
eload!(int,0)();
eload!(int,1)();
}
//-------------------
void FNfoo() {}
void load(string name, alias T = mixin("FN" ~ name))() {}
void test1()
{
load!"foo"();
load!"wtf"();
}