ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since 8e138da was
8e138da,
checked in by Rob Schluntz <rschlunt@…>, 7 years ago
|
Add test case for autogenerated functions
|
-
Property mode set to
100644
|
File size:
646 bytes
|
Line | |
---|
1 | enum Color { R, G, B }; |
---|
2 | |
---|
3 | // empty struct/union should have generated ctor/dtors |
---|
4 | union U {}; |
---|
5 | struct S {}; |
---|
6 | |
---|
7 | // struct/union with members with generated ctor/dtors should themselves have generated ctor/dtors |
---|
8 | union PopulatedUnion { |
---|
9 | Color c; |
---|
10 | U u; |
---|
11 | S s; |
---|
12 | }; |
---|
13 | |
---|
14 | struct PopulatedStruct { |
---|
15 | Color state; |
---|
16 | U u; |
---|
17 | S s; |
---|
18 | }; |
---|
19 | |
---|
20 | forall(otype T) |
---|
21 | T identity(T x) { return x; } |
---|
22 | |
---|
23 | int main() { |
---|
24 | S s; |
---|
25 | U u; |
---|
26 | |
---|
27 | identity(R); // Color should be an otype |
---|
28 | identity(u); // U should be an otype |
---|
29 | identity(s); // S should be an otype |
---|
30 | |
---|
31 | PopulatedStruct ps; |
---|
32 | PopulatedUnion pu; |
---|
33 | |
---|
34 | identity(ps); // should recursively be an otype |
---|
35 | identity(pu); // should recursively be an otype |
---|
36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.