ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexerpthread-emulationqualifiedEnum
Last change
on this file since cf0de0e was
d804830,
checked in by Rob Schluntz <rschlunt@…>, 6 years ago
|
Remove outdated comment from nested-types test
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
Line | |
---|
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 | // |
---|
7 | // nested-types.c -- |
---|
8 | // |
---|
9 | // Author : Rob Schluntz |
---|
10 | // Created On : Mon Jul 9 10:20:03 2018 |
---|
11 | // Last Modified By : Rob Schluntz |
---|
12 | // Last Modified On : Mon Jul 9 10:20:03 2017 |
---|
13 | // Update Count : 1 |
---|
14 | // |
---|
15 | |
---|
16 | typedef int N; |
---|
17 | struct A { |
---|
18 | forall(otype T) |
---|
19 | struct N { |
---|
20 | T x; |
---|
21 | }; |
---|
22 | }; |
---|
23 | |
---|
24 | struct 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 | |
---|
53 | int 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 // |
---|
90 | // compile-command: "cfa nested-types.c" // |
---|
91 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.