mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-01 10:52:14 +00:00
28 lines
415 B
Nim
28 lines
415 B
Nim
discard """
|
|
action: compile
|
|
"""
|
|
|
|
#[
|
|
bug #4766
|
|
see also: tnested_generic_instantiation.nim
|
|
]#
|
|
|
|
proc toString*[T](x: T) =
|
|
for name, value in fieldPairs(x):
|
|
when compiles(toString(value)):
|
|
discard
|
|
toString(value)
|
|
|
|
type
|
|
Plain = ref object
|
|
discard
|
|
|
|
Wrapped[T] = object
|
|
value: T
|
|
|
|
converter toWrapped[T](value: T): Wrapped[T] =
|
|
Wrapped[T](value: value)
|
|
|
|
let result = Plain()
|
|
toString(result)
|