31 lines · cpp
1// RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection -verify %s2 3using size_t = __typeof(sizeof(int));4 5void clang_analyzer_explain(int);6void clang_analyzer_dump(int);7void *memset(void *, int, size_t);8 9struct S10{11 static int a;12 ~S(){};13};14 15int S::a = 0;16 17void foo()18{19 S::a = 0;20 21 int x = 3;22 memset(&x, 1, sizeof(x));23 24 S *arr = new S[x];25 delete[] arr;26 27 clang_analyzer_dump(S::a); // expected-warning-re{{{{derived_\$[0-9]+{conj_\$[0-9]+{int, LC[0-9]+, S[0-9]+, #[0-9]+},a}}}}}28 29 clang_analyzer_explain(S::a); // expected-warning-re{{{{value derived from \(symbol of type 'int' conjured at CFG element '->~S\(\) \(Implicit destructor\)'\) for global variable 'S::a'}}}}30}31