Open litlighilit opened 5 months ago
!nim c
template t(n: float) = discard
template t(todecl: untyped, x: int) =
discard
t(ii, 3)
0 bytes (0 bytes)
```cpp
```
2024-05-30T13:13:12
2024-05-30T13:13:12
0 bytes (0 bytes)
```cpp
```
2024-05-30T13:13:13
2024-05-30T13:13:13
0 bytes (0 bytes)
```cpp
```
2024-05-30T13:13:13
2024-05-30T13:13:13
0 bytes (0 bytes)
```cpp
```
2024-05-30T13:13:17
2024-05-30T13:13:17
0 bytes (0 bytes)
```cpp
```
2024-05-30T13:13:20
2024-05-30T13:13:20
0 bytes (0 bytes)
```cpp
```
2024-05-30T13:13:22
2024-05-30T13:13:23
0 bytes (0 bytes)
```cpp
```
2024-05-30T13:13:26
2024-05-30T13:13:26
0 bytes (0 bytes)
```cpp
```
2024-05-30T13:13:28
2024-05-30T13:13:28
11.4.0
14.0.0
20.3
2024-05-30T13:12:41Z
1
nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
:robot: Bug found in 20 minutes
bisecting 8
commits at 0
commits per second
Same behaviour from 1.0 to devel. 🤷
This is required for dispatch, overloaded macros and templates have to semantically check arguments for a call in cases of ambiguity.
Another workaround:
make the overloaded templates' param untyped, too.
Description
If a template with untyped params is overloaded, then when the variant with
untyped
param is called, such a argument (symbol) will be resolved there.In addition, either of the followings compiles without mistake:
Or
Nim Version
Nim Compiler Version 2.1.1 [Windows: amd64] Compiled at 2024-04-27 Copyright (c) 2006-2024 by Andreas Rumpf
active boot switches: -d:release
Current Output
Expected Output
Possible Solution
No response
Additional Information
So does for
macro
,proc
, etc.