-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
Description
The following snippet doesn't compile:
func what[T](): T =
discard
type MyObject[T] = object
f: T = what[T]()
var m: MyObject[float] = MyObject[float]()
echo m
However, this one works fine:
func what[T](): T =
discard
type MyObject = object
f: float = what[float]()
var m: MyObject = MyObject()
echo m
Nim Version
Nim Compiler Version 1.9.3 [Linux: amd64]
Compiled at 2023-05-27
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: 2beea72
active boot switches: -d:release
Current Output
/tmp/testtest/main.nim(5, 12) Error: cannot instantiate: 'what[T]'
Expected Output
(vec: 0.0)
# or an easier to understand error message
Possible Solution
No response
Additional Information
No response