Skip to content

proc v[T: typedesc]() = discard / v[0]() compiles even though 0 isn't a typedesc #25262

@tersec

Description

@tersec

Nim Version

Nim Compiler Version 2.2.4 [Linux: amd64]
Compiled at 2025-11-03
Copyright (c) 2006-2025 by Andreas Rumpf

git hash: f7145dd26efeeeb6eeae6fff649db244d81b212d
active boot switches: -d:release
Nim Compiler Version 2.2.6 [Linux: amd64]
Compiled at 2025-11-05
Copyright (c) 2006-2025 by Andreas Rumpf

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

git hash: cfefd1d95b02fe8c099ee28074616031cf5a0b3b
active boot switches: -d:release

Description

proc v[T: typedesc]() = discard
v[0]()

Current Output

Compiles

Expected Output

Compilation error due to 0 not being a `typedesc`

Known Workarounds

No response

Additional Information

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions