File: err-const.ispc

package info (click to toggle)
ispc 1.28.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 97,620 kB
  • sloc: cpp: 77,067; python: 8,303; yacc: 3,337; lex: 1,126; ansic: 631; sh: 475; makefile: 17
file content (47 lines) | stat: -rw-r--r-- 886 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// RUN: not %{ispc} --target=host --nowrap --nostdlib %s -o - 2>&1 | FileCheck %s

// CHECK: Error: Can't assign to type "const varying int32" on left-hand

int func() {
    const int x = 2;
    ++x;
}


// CHECK: Error: Can't assign to type "const varying unsigned int32" on left-hand

int func1() {
    const uint x = 2;
    x = 0;
}

// CHECK: Error: Can't assign to type "const varying int16" on left-hand

struct Foo {
    int16 x;
};

int func2(const Foo f) {
    f.x = 0;
}

// CHECK: Error: Can't assign to type "const varying int8" on left-hand

int func3(const int8 f) {
    f -= 2;
}

// CHECK: Error: Can't assign to type "const varying int64" on left-hand

int func4() {
    const int64 a[10] = {1,2,3,4,5,6,7,8,9,10};
    a[0] = 1;
}

// CHECK: Error: Can't assign to type "const varying unsigned int8" on left-hand

const unsigned int8 gl = 0;

void foo5() {
    ++gl;
}