source: tests/nested-types.cfa @ a62749f

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since a62749f was dc8511c, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

first attempt at updating suffixes for test programs

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[49e1275]1//
2// Cforall Version 1.0.0 Copyright (C) 2018 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//
[dc8511c]7// nested-types.cfa --
[49e1275]8//
9// Author           : Rob Schluntz
10// Created On       : Mon Jul 9 10:20:03 2018
[dc8511c]11// Last Modified By : Peter A. Buhr
12// Last Modified On : Tue Nov  6 17:59:40 2018
13// Update Count     : 2
[49e1275]14//
15
16typedef int N;
17struct A {
[d804830]18  forall(otype T)
[3d7e53b]19  struct N {
20    T x;
21  };
[49e1275]22};
23
24struct S {
25  struct T {
26    int i;
27    typedef int Bar;
28  };
29  T x;
30
31  // struct U;
32  typedef T Bar;
33  typedef int Baz;
34};
35
36// // // // need a way to stuff a qualified name into a struct decl
37// // struct S.U {
38// //   double z;
39// // };
40
41// // what will this do?
42// struct U {
43//   union S {
44//     int i;
45//     double d;
46//   };
47// };
48
49// struct T {
50//   double d;
51// };
52
53int main() {
54  // access nested struct
55  S.T x;
56
57  {
58    struct S {
59      int i;
60      struct Z {
61        double d;
62      };
63    };
64
65    S.Z z;   // gets local S
66    .S.T y;  // lookup at global scope only
67
68    const volatile .S.T q;
69#if ERR1
70    T err1;           // error: no T in scope
71#endif
72#if ERR2
73    .Z err2;          // error: no Z in global scope
74    .S.Baz.Bar err3;  // error: .S.Baz => int, int is not aggregate and should not appear left of the dot
75    .S.Z err4;        // error: no Z in global S
76#endif
77  }
78
79  // U.S un;
80
81  S.Bar y;
82  S.Baz x;
83  S.T.Bar z;
84
85  // A.N(int) x;  // xxx - should not be an error, but currently is.
86}
87
88// Local Variables: //
89// tab-width: 4 //
[dc8511c]90// compile-command: "cfa nested-types.cfa" //
[49e1275]91// End: //
Note: See TracBrowser for help on using the repository browser.