aboutsummaryrefslogtreecommitdiff
path: root/compiler/tests/parser/def_function_special.bad
blob: a7099448847b043608719d498f7b42eab6900c06 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

/* ERRORS noreturn syntax errors in function declarations */
noreturn;
noreturn a;
noreturn int b;
noreturn#[1] c;
(noreturn)^ d;
noreturn^()^ e;
int f() noreturn;
noreturn noreturn;
noreturn noreturn g;

/* ERRORS noreturn syntax errors in function types */
typedef ta = noreturn;
typedef tb = noreturn x;
typedef tc = noreturn int;
typedef td = noreturn#[1];
typedef te = (noreturn)^;
typedef tf = noreturn^()^;
typedef tg = int noreturn;
typedef th = ()noreturn;
typedef ti = noreturn noreturn;

/* ERRORS */
() variadic1(...*); // need at least one parameter
() variadic2(int y...*); // wrong syntax
() variadic3(int...* y); // wrong syntax
typedef variadictype1 = ()(...*);
typedef variadictype2 = ()(int x, (int a)^ y...*);
typedef variadictype3 = ()(int...* x);
typedef variadictype4 = ()(int x, (int a)^...* y);

// Trying to use a corrupt function definition as a struct
var ta da;
var tb db;
var tc dc;
var td dd;
var te de;
var tf df;
var tg dg;
var th dh;
var ti di;
() test()
{

    /* ERRORS OPTIONAL */
    da.x = 123;
    db.x = 123;
    dc.x = 123;
    dd.x = 123;
    df.x = 123;
    dg.x = 123;
    dh.x = 123;
    di.x = 123;

}