Skip to content
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

Template is expanded during declared() check if the check is in a generic proc #16672

Open
alaviss opened this issue Jan 10, 2021 · 0 comments
Open

Comments

@alaviss
Copy link
Collaborator

alaviss commented Jan 10, 2021

Example

template fooImpl() =
  discard

proc foo[T]() =
  when declared(fooImpl):
    fooImpl()
  else:
    {.error: "foo is not implemented for this target".}

foo[int]()

Current Output

test.nim(10, 4) template/generic instantiation of `foo` from here
test.nim(5, 17) Error: identifier expected, but got: 
discard

Additional Information

  • Doesn't happen if the proc is not a generic.
$ nim -v
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-01-05
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: 2c2baa9fad1d144c42baf30ed004decdf8bb0483
active boot switches: -d:release -d:nimUseLinenoise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant