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

Codegen error when using container of containers #5402

Closed
endragor opened this issue Feb 16, 2017 · 0 comments
Closed

Codegen error when using container of containers #5402

endragor opened this issue Feb 16, 2017 · 0 comments

Comments

@endragor
Copy link
Contributor

endragor commented Feb 16, 2017

import lists

type
  Container[T] = ref object
    obj: T

  ListOfContainers[T] = ref object
    list: DoublyLinkedList[Container[T]]

proc contains[T](this: ListOfContainers[T], obj: T): bool =
  for item in this.list.items():
    if item.obj == obj: return true
  return false

proc newListOfContainers[T](): ListOfContainers[T] =
  new(result)
  result.list = initDoublyLinkedList[Container[T]]()

let q = newListOfContainers[int64]()
echo q.contains(123)

Errors after invoking nim c:

sample.c:425:14: error: expected identifier
                colontmp_. = (*this_0).list.;
                           ^
sample.c:425:31: error: expected identifier
                colontmp_. = (*this_0).list.;
                                            ^
sample.c:426:14: error: expected identifier
                colontmp_. = (*this_0).list.;
                           ^
sample.c:426:31: error: expected identifier
                colontmp_. = (*this_0).list.;
                                            ^
4 errors generated.

Git hash: 5b5bd38

@Araq Araq closed this as completed in 6499462 Feb 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant