New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic arguments cannot be used in templates (raising undeclared identifier) #3498
Comments
nanoant
added a commit
to nanoant/Nim
that referenced
this issue
Oct 29, 2015
Previously it was not possible to use template arguments in template body as the symbols were not resolved correctly leading to Error: undeclared identifier: 'XX', eg.: template defaultOf[T](t: T): expr = (var d: T; d) echo defaultOf(1) #<- invalid identifier, but should output 0
nanoant
added a commit
to nanoant/Nim
that referenced
this issue
Oct 29, 2015
Previously it was not possible to use template arguments in template body as the symbols were not resolved correctly leading to Error: undeclared identifier: 'XX', eg.: template defaultOf[T](t: T): expr = (var d: T; d) echo defaultOf(1) #<- invalid identifier, but should output 0
I applied your patch to upstream devel and now compiler crashes on th following code:
with error |
Yes, .immediate templates are not subject to type checking and about to become deprecated. |
Araq
added a commit
that referenced
this issue
Jan 14, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently there is no way to use generic arguments in templates, as if their identifiers were not replaced by their generic argument values during template evaluation.
The text was updated successfully, but these errors were encountered: