source: src/tests/polymorphism.c @ aabc60c

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since aabc60c was aabc60c, checked in by Rob Schluntz <rschlunt@…>, 7 years ago

Add polymorphism test case

  • Property mode set to 100644
File size: 697 bytes
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// polymorphism.c --
8//
9// Author           : Rob Schluntz
10// Created On       : Tue Oct 17 12:19:48 2017
11// Last Modified By : Rob Schluntz
12// Last Modified On : Tue Oct 17 12:21:07 2017
13// Update Count     : 1
14//
15
16forall(otype T)
17T f(T x, T y) {
18  x = y;
19  return x;
20}
21
22int main() {
23  // ensure that x is not changed by the invocation of a polymorphic function
24  int x = 123;
25  int y = 456;
26  int z = f(x, y);
27  printf("%d %d %d\n", x, y, z);
28}
29
30// Local Variables: //
31// tab-width: 4 //
32// End: //
Note: See TracBrowser for help on using the repository browser.