Partially instantiating templates?
Magnus Lie Hetland
magnus at hetland.org
Tue Feb 1 03:32:23 PST 2011
On 2011-02-01 10:12:44 +0100, Magnus Lie Hetland said:
> On 2011-01-31 19:46:53 +0100, Simen kjaeraas said:
>
>> Magnus Lie Hetland <magnus at hetland.org> wrote:
>>
>>> Hm. Using code quite similar to you, supplying a lambda in the second
>>> aliasing, I get this error:
>>>
>>> something.d(93): Error: template instance cannot use local
>>> '__dgliteral2(__T3)' as parameter to non-global template optArg(alias
>>> fun)
> [snip]
>>
>> This is a bug. Please report it.
>
> Ah -- OK. Will do.
Hm. Just to make sure this *is* a bug, and I'm not just being a dumbass
... this is a tiny program that illustrates the problem (i.e., gives
the error above). Perhaps the use of a local function here really is
prohibited...?
template A(int op) {
template A(alias fun) {
auto A(T)(T x) {
return 0;
}
}
}
alias A!0 B;
int gun() {
return 0;
}
void main() {
int fun() {return 0;}
// alias B!((){return 0;}) C; // Won't compile
// alias B!(fun) C; // Won't compile
alias B!(gun) C; // Works
}
--
Magnus Lie Hetland
http://hetland.org
More information about the Digitalmars-d-learn
mailing list