t4799_3.nim 414 B

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