Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile crash (stack overflow) on recursive generic type #16175

Closed
zevv opened this issue Nov 28, 2020 · 1 comment · Fixed by #24119
Closed

Compile crash (stack overflow) on recursive generic type #16175

zevv opened this issue Nov 28, 2020 · 1 comment · Fixed by #24119

Comments

@zevv
Copy link
Contributor

zevv commented Nov 28, 2020

Below is an attempt to make a limited-recursive data type using static generics, crashing the compiler with a SIGSEGV:

type

  Thing[D: static uint] = object
    when D == 0:
      kid: char
    else:
      kid: Thing[D-1]

var s = Thing[1]()

My assumption was that Thing[1] would have Thing[0] as it's only element, and the Thing[0] type would get a char. Not sure if this is even supposed to work...

@metagn
Copy link
Collaborator

metagn commented Jun 24, 2023

Now gives Error: call depth limit reached in a debug build (2000 function calls). during type instantiation

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

Successfully merging a pull request may close this issue.

2 participants