mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
(cherry picked from commit 04c48e3c5b)
This commit is contained in:
16
tests/whenstmt/t19426.nim
Normal file
16
tests/whenstmt/t19426.nim
Normal file
@@ -0,0 +1,16 @@
|
||||
type
|
||||
MyInt = object
|
||||
bitWidth: int
|
||||
|
||||
template toRealType*(t: MyInt): typedesc =
|
||||
when t.bitWidth == 32: int32
|
||||
elif t.bitWidth == 64: int64
|
||||
else: {.error.}
|
||||
|
||||
proc doFail(T: typedesc): T = default(T)
|
||||
|
||||
proc test =
|
||||
const myInt = MyInt(bitWidth:32)
|
||||
discard doFail(toRealType(myInt))
|
||||
|
||||
test()
|
||||
Reference in New Issue
Block a user