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

Cannot compute sizeof generic type in alias #24045

Open
arnetheduck opened this issue Sep 2, 2024 · 1 comment
Open

Cannot compute sizeof generic type in alias #24045

arnetheduck opened this issue Sep 2, 2024 · 1 comment
Labels

Comments

@arnetheduck
Copy link
Contributor

Description

type ArrayBuf*[N: static int, T] = object
  buf: array[N, T]

func maxLen(T: type): int =
  sizeof(T) * 2

type MyBuf[I: type] = ArrayBuf[maxLen(I), byte]

var v: MyBuf[int]

note I: type in alias - removing it gives #24043 instead

Nim Version

2.0.8

Current Output

testit.nim(5, 9) Error: 'sizeof' requires '.importc' types to be '.completeStruct'

Expected Output

No response

Known Workarounds

No response

Additional Information

No response

@arnetheduck arnetheduck changed the title Cannot compute sizeof generic type, Cannot compute sizeof generic type in alias Sep 2, 2024
arnetheduck added a commit to status-im/nim-stew that referenced this issue Sep 2, 2024
@ringabout ringabout added the Needs Backporting/Fixed in Devel The issues can be solved via backporting label Sep 2, 2024
@metagn
Copy link
Collaborator

metagn commented Sep 2, 2024

Would guess fixed by #23983 but not sure

Probably shouldn't backport but add test case instead

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

No branches or pull requests

3 participants