ADTast-experimentalpthread-emulation
Last change
on this file since 50ff1d0 was
53692b3,
checked in by Peter A. Buhr <pabuhr@…>, 3 years ago
|
second attempt to fix compile-only pragma message that gcc-10/11 quote
|
-
Property mode set to
100644
|
File size:
1.8 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.cfa -- |
---|
8 | // |
---|
9 | // Author : Rob Schluntz |
---|
10 | // Created On : Mon Jul 9 10:20:03 2018 |
---|
11 | // Last Modified By : Peter A. Buhr |
---|
12 | // Last Modified On : Sat Jun 5 10:07:42 2021 |
---|
13 | // Update Count : 7 |
---|
14 | // |
---|
15 | |
---|
16 | typedef int N; |
---|
17 | struct A { |
---|
18 | forall(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 | // struct S { |
---|
54 | // enum C { R, G, B }; |
---|
55 | // int i; |
---|
56 | // struct T { |
---|
57 | // int i; |
---|
58 | // }; |
---|
59 | // T t; |
---|
60 | // }; |
---|
61 | |
---|
62 | // S s; |
---|
63 | // S.C c; |
---|
64 | // S.T t; |
---|
65 | |
---|
66 | int main() { |
---|
67 | // access nested struct |
---|
68 | S.T x; |
---|
69 | |
---|
70 | { |
---|
71 | struct S { |
---|
72 | int i; |
---|
73 | struct Z { |
---|
74 | double d; |
---|
75 | }; |
---|
76 | }; |
---|
77 | |
---|
78 | S.Z z; // gets local S |
---|
79 | .S.T y; // lookup at global scope only |
---|
80 | |
---|
81 | const volatile .S.T q; |
---|
82 | #if ERR1 |
---|
83 | T err1; // error: no T in scope |
---|
84 | #endif |
---|
85 | #if ERR2 |
---|
86 | .Z err2; // error: no Z in global scope |
---|
87 | .S.Baz.Bar err3; // error: .S.Baz => int, int is not aggregate and should not appear left of the dot |
---|
88 | .S.Z err4; // error: no Z in global S |
---|
89 | #endif |
---|
90 | } |
---|
91 | |
---|
92 | // U.S un; |
---|
93 | |
---|
94 | S.Bar y; |
---|
95 | S.Baz x; |
---|
96 | S.T.Bar z; |
---|
97 | |
---|
98 | // A.N(int) x; // xxx - should not be an error, but currently is. |
---|
99 | |
---|
100 | #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! |
---|
101 | } |
---|
102 | |
---|
103 | // Local Variables: // |
---|
104 | // tab-width: 4 // |
---|
105 | // compile-command: "cfa nested-types.cfa" // |
---|
106 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.