t4799_1.nim 446 B

1234567891011121314151617181920212223
  1. discard """
  2. matrix: "--mm:refc"
  3. targets: "c cpp"
  4. outputsub: '''ObjectAssignmentDefect'''
  5. exitcode: "1"
  6. """
  7. type
  8. Vehicle[T] = object of RootObj
  9. tire: T
  10. Car[T] = object of Vehicle[T]
  11. Bike[T] = object of Vehicle[T]
  12. proc testVehicle[T](x: varargs[Vehicle[T]]): string =
  13. result = ""
  14. for c in x:
  15. result.add $c.tire
  16. var v = Vehicle[int](tire: 3)
  17. var c = Car[int](tire: 4)
  18. var b = Bike[int](tire: 2)
  19. echo testVehicle b, c, v