function(pointer) as template argument, explicit template instantiation
kdevel
kdevel at vogtner.de
Fri Dec 31 00:57:26 UTC 2021
```dptr.d
class R {
}
void foo (R r)
{
}
alias fn = void function (R);
void lyr (fn F) (R r)
{
}
immutable fn foo_ptr = &foo; // line 14
pragma (msg, typeof (foo_ptr));
auto ptr = lyr!(foo_ptr); // line 17
```
dmd reports:
```
immutable(void function(R))
dptr.d(14): Error: expression `& foo` is not a valid template
value argument
```
If I comment out line 17 the code compiles. I want to put the
explicitly instantiated function template into an immutable AA.
How can that be phrased such that dmd compiles it?
More information about the Digitalmars-d-learn
mailing list