You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, given:
template A() {
template A() {
enum A = 1;
}
}
This:
A!()!()
does not compile (multiple ! arguments are not allowed).
Neither does this (C style cast illegal):
(A!())!()
The only way to invoke the nested template seems to be:
alias B = A!();
B!()
This is less than ideal.
The text was updated successfully, but these errors were encountered:
import std.meta : Instantiate;
template A() {
template A() {
enum A = 1;
}
}
unittest {
enum i = Instantiate!(A!());
}
Now, that shows it's possible in the language to work around this issue. The real issue however, is that multiple ! arguments are not allowed.
From what I can gather on the forum, the reason is a perceived ambiguity, in that F!T!int could mean F!(T!int) or (F!T)!int. The language already provides tools to disambiguate between them - the first example is how you'd invoke it that way, and the other example is simply impossible in the language right now.
Yuxuan Shui (@yshui) reported this on 2018-08-05T00:13:40Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=19139
CC List
Description
Currently, given: template A() { template A() { enum A = 1; } } This: A!()!() does not compile (multiple ! arguments are not allowed). Neither does this (C style cast illegal): (A!())!() The only way to invoke the nested template seems to be: alias B = A!(); B!() This is less than ideal.The text was updated successfully, but these errors were encountered: