blob: 7f2177e5791ce2460010e5b4b126cb81a62a4958 [file] [log] [blame]
George Karpenkovcf40ba82018-08-09 19:03:12 +00001// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.cplusplus.UninitializedObject -std=c++11 -fblocks -verify %s
2
3typedef void (^myBlock) ();
4
5struct StructWithBlock {
6 int a;
7 myBlock z; // expected-note{{uninitialized field 'this->z'}}
8
9 StructWithBlock() : a(0), z(^{}) {}
10
11 // Miss initialization of field `z`.
12 StructWithBlock(int pA) : a(pA) {} // expected-warning{{1 uninitialized field at the end of the constructor call}}
13
14};
15
16void warnOnUninitializedBlock() {
17 StructWithBlock a(10);
18}
19
20void noWarningWhenInitialized() {
21 StructWithBlock a;
22}