blob: c5fa37aadebfe5e40754afa699ce3fd097fde4e7 (
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
//TEST:SIMPLE(filecheck=CHK): -target spirv
extern static const int flag;
struct None
{
int a;
int b;
__init()
{
a = 0;
b = 0;
}
}
struct Simple
{
int value;
Simple *next;
__init(int v, Simple* ptr)
{
value = v;
//CHK-DAG: warning 41020: exiting constructor without initializing field 'next'
}
}
struct Conditional
{
int field;
int another_field;
__init()
{
field = 0;
if (flag == 0)
//CHK-DAG: warning 41020: exiting constructor without initializing field 'another_field'
return;
another_field = 0;
}
};
struct Partial
{
int inline = 0;
int body = 0;
__init(int x)
{
body = x;
}
}
// Warnings here should be a bit different
struct Implicit
{
//CHK-DAG: warning 41021: default initializer for 'Implicit' will not initialize field 'a'
int a;
int b = 1;
//CHK-DAG: warning 41021: default initializer for 'Implicit' will not initialize field 'c'
int c;
int d = 1 + 1;
}
int using_implicit(int x)
{
Implicit impl;
impl.a = x;
return impl.c;
}
struct UnusedImplicit
{
// Shouldn't warn here, since its never used
int a;
int b = 1;
int c;
int d = 1 + 1;
}
struct Pass
{
int x = 0;
int y = 0;
}
//CHK-NOT: warning 41020
//CHK-NOT: warning 41021
|