ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        jacob/cs343-translation
        jenkins-sandbox
        new-ast
        new-ast-unique-expr
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        resolv-new
        with_gc
      
      
        
          | Last change
 on this file since 5434d04 was             aabc60c, checked in by Rob Schluntz <rschlunt@…>, 8 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 |  | 
|---|
| 16 | forall(otype T) | 
|---|
| 17 | T f(T x, T y) { | 
|---|
| 18 | x = y; | 
|---|
| 19 | return x; | 
|---|
| 20 | } | 
|---|
| 21 |  | 
|---|
| 22 | int 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.