aboutsummaryrefslogtreecommitdiff
path: root/compiler/tests/parser/def_var_quals.bad
blob: 6e5e58930328ba4aafc0f6cfda9df7a9ba371968 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

/* ERRORS: const is the default for data definitions */
const int ga;
const (int a, int b) gb;
const enum(yes, no) gc_;
const int enum(yes, no) gd;
int const^ ge;

() f1() {
    /* ERRORS: const is also the default for local data definitions */
    const int la;
    const (int a, int b) lb;
    const enum(yes, no) lc;
    const int enum(yes, no) ld;
    int const^ le;
    
    shared int x; // ERROR who else can modify x if it's not mutable?
}

/* ERRORS: function parameters are always const and can't have qualifiers */
(const int z) f2() {}
() f3(const int x) {}
() f4(int x, int const^ y) {}
(var int z) f5() {}
() f6(shared int x) {}

/* ERRORS: multiple "var" qualifiers on nested types make no sense */
var (var int xx) nested;