Skip to content

Instantly share code, notes, and snippets.

@gmpreussner
Created February 14, 2015 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmpreussner/af6cceaa2c54403b6c87 to your computer and use it in GitHub Desktop.
Save gmpreussner/af6cceaa2c54403b6c87 to your computer and use it in GitHub Desktop.
static[T] hangs compiler
type
RectArray*[R, C: static[int], T] = distinct array[R * C, T]
StaticMatrix*[R, C: static[int], T] = object
elements*: RectArray[R, C, T]
StaticVector*[N: static[int], T] = StaticMatrix[N, 1, T]
proc foo*[N, T](a: StaticVector[N, T]): T = 0.T
proc foobar*[N, T](a, b: StaticVector[N, T]): T = 0.T
var a: StaticVector[3, int]
echo foo(a) # OK
echo foobar(a, a) # <--- hangs compiler
@gmpreussner
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment