I want to use static generics in object definition for memory efficiency. But
this makes many trouble especially with concepts. The following code cannot be
compiled with message "SC: cannot generate code for: b". What is happening?
I also know that if I comment out line "x is S" in the concept definition, the
code can be compiled.
type S[T;b:static[bool]] = object
a:int
when b:
x:int
var af:S[int, false]
var at:S[int, true]
type SC = concept x
x is S # when commnet out this, it can be compiled
discard
static:
echo S is SC
proc test[CLS:SC](self: CLS):CLS =
return self
echo af.test()
echo at.test()
Run