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

Error: cannot evaluate at compile time: v with template in const context #24634

Open
tersec opened this issue Jan 21, 2025 · 1 comment
Open

Comments

@tersec
Copy link
Contributor

tersec commented Jan 21, 2025

Description

type J = object

template m(u: J): int =
  let v = u
  0

proc g() =
  const x = J()
  const _ = m(x)

g()

Nim Version

Nim Compiler Version 2.0.14 [Linux: amd64]
Compiled at 2025-01-21
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: bf4de6a394e040d9810cba8c69fb2829ff04dcc6
active boot switches: -d:release
Nim Compiler Version 2.2.1 [Linux: amd64]
Compiled at 2025-01-21
Copyright (c) 2006-2025 by Andreas Rumpf

git hash: 12347eae74dbaa0e4dd99691e3a4509e8fe8b265
active boot switches: -d:release
Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2025-01-21
Copyright (c) 2006-2025 by Andreas Rumpf

git hash: 793baf34ff72cb8c5485ce209af086e27f656853
active boot switches: -d:release

Current Output

k.nim(4, 7) Error: cannot evaluate at compile time: v`gensym0

Expected Output

Compiles

Known Workarounds

No response

Additional Information

No response

@metagn
Copy link
Collaborator

metagn commented Jan 21, 2025

Similar to #24633, consequence of #8758, #10828, #12172

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants