source: tests/poly-selection.cfa @ 3d3d75e

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 3d3d75e was 978e5eb, checked in by Michael Brooks <mlbrooks@…>, 3 years ago

Calculation of specialization benefit (spec "cost") looks inside the body of xInstTypes, counting one benefit for each inner type constructor met. Fixes 225?

  • Property mode set to 100644
File size: 1004 bytes
RevLine 
[978e5eb]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// poly-selection.cfa -- tests that show correct candidates selected, given interesting cases of
8//                       forall/overload polymoprphism
9//
10// Author           : Michael Brooks
11// Created On       : Mon Jan 18 15:00:00 2021
12// Last Modified By : Michael Brooks
13// Last Modified On : Mon Jan 18 15:00:00 2021
14// Update Count     : 1
15//
16
17void testSpecializationFromGenericOverBareTyvar() {
18    forall( dtype T )
19    void friend( T & ) {
20        printf("friending generically\n");
21    }
22
23    forall(dtype T)
24    struct thing {
25        int x;
26    };
27
28    forall( dtype T )
29    void friend( thing(T) & ) {
30        printf("friending specifically\n");
31    }
32
33    float x;           friend( x );
34    thing(float) y;    friend( y );
35}
36
37
38int main() {
39    testSpecializationFromGenericOverBareTyvar();
40}
Note: See TracBrowser for help on using the repository browser.