1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -std=c++11 -verify %s
2 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -std=c++17 -verify %s
4 #include "Inputs/system-header-simulator-cxx.h"
6 void clang_analyzer_eval(bool);
26 void flexibleArrayMember()
34 (Flex
*)::operator new(__builtin_offsetof(Flex
, contents
) + sizeof(S
) * size
);
36 clang_analyzer_eval(S::c
== 0); // expected-warning{{TRUE}}
38 new (&arr
->contents
[0]) S
;
39 new (&arr
->contents
[1]) S
;
40 new (&arr
->contents
[2]) S
;
41 new (&arr
->contents
[3]) S
;
43 clang_analyzer_eval(S::c
== size
); // expected-warning{{TRUE}}
45 clang_analyzer_eval(arr
->contents
[0].x
== 0); // expected-warning{{TRUE}}
46 clang_analyzer_eval(arr
->contents
[1].x
== 1); // expected-warning{{TRUE}}
47 clang_analyzer_eval(arr
->contents
[2].x
== 2); // expected-warning{{TRUE}}
48 clang_analyzer_eval(arr
->contents
[3].x
== 3); // expected-warning{{TRUE}}
50 arr
->contents
[0].~S();
51 arr
->contents
[1].~S();
52 arr
->contents
[2].~S();
53 arr
->contents
[3].~S();
55 ::operator delete(arr
);
57 clang_analyzer_eval(S::d
== size
); // expected-warning{{TRUE}}