source: tests/enum_tests/structEnum.cfa @ d96f7c4

Last change on this file since d96f7c4 was 10b5970, checked in by Michael Brooks <mlbrooks@…>, 2 weeks ago

Fix many test-suite- and libcfa-caused unused variable warnings.

In scope are easy fixes among tests whose sole warnings were unused variable. Reduces the wflags lax list by 40%.

  • Property mode set to 100644
File size: 736 bytes
Line 
1#include <stdio.h>
2
3struct Point {
4     int x;
5     char y;
6};
7
8enum(Point) PointEnum {
9     first={
10         100,
11         'c'
12     },
13     second={
14         200,
15         'a'
16     }
17};
18
19PointEnum identity(PointEnum in) {
20     return in;
21}
22
23// The only valid usage
24struct Point apple = first;
25// Failed due to Qualified name is currently unimplemented.
26
27int main() {
28     PointEnum vals = second;      (void) vals;
29     PointEnum val2;               (void) val2;
30     // The failing line: assignment
31     // val2 = vals;
32
33     printf("%d %c\n", apple.x, apple.y);
34     // Failed; enumInstType is now not a real type and not instantiated.
35     // Not sure if we want that
36     // printf("%d %c\n", second.x, second.y);
37     return 0;
38}
Note: See TracBrowser for help on using the repository browser.