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

Unsigned integers could not be used as array indexes. #7153

Closed
cheatfate opened this issue Jan 30, 2018 · 2 comments
Closed

Unsigned integers could not be used as array indexes. #7153

cheatfate opened this issue Jan 30, 2018 · 2 comments
Labels

Comments

@cheatfate
Copy link
Member

This code could not be compiled, because UnsignedConst is unsigned integer,
with error Error: ordinal type expected

const
  UnsignedConst = 1024'u
type
  SomeObject* = object
    s1: array[UnsignedConst, uint32]
@bluenote10
Copy link
Contributor

According to the manual it is by design that unsigned integers are not ordinal. The question why they are not was also raised in a related issue #6620.

@Araq
Copy link
Member

Araq commented Jan 30, 2018

That's true but array indexing does not have to be bound by the "ordinal type" constraint.

@cheatfate cheatfate changed the title Unsigned integers are not ordinal Unsigned integers could not be used as array indexes. Jan 30, 2018
@Araq Araq closed this as completed in 5c5e54d Feb 10, 2018
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

4 participants