blob: 3ec1eb75182ef9833ce6237b540adaffa88037c0 [file] [log] [blame]
// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.cplusplus.UninitializedObject -std=c++11 -fblocks -verify %s
typedef void (^myBlock) ();
struct StructWithBlock {
int a;
myBlock z; // expected-note{{uninitialized pointer 'this->z'}}
StructWithBlock() : a(0), z(^{}) {}
// Miss initialization of field `z`.
StructWithBlock(int pA) : a(pA) {} // expected-warning{{1 uninitialized field at the end of the constructor call}}
};
void warnOnUninitializedBlock() {
StructWithBlock a(10);
}
void noWarningWhenInitialized() {
StructWithBlock a;
}