1 // RUN: %clang_analyze_cc1 -w -analyzer-checker=core -verify %s
3 // expected-no-diagnostics
5 typedef __typeof(sizeof(int)) size_t;
6 void *operator new(size_t, void *h
) { return h
; }
8 // I've no idea what this code does, but it used to crash, so let's keep it.
40 void *c
= const_cast<Z
*>(this);
42 t
.f(*static_cast<J
*>(c
));
44 t
.f(*static_cast<bool *>(c
));
54 } // namespace pr37802_v1
57 // This slightly modified code crashed differently.
58 namespace pr37802_v2
{
68 void f(const J
&t
) { new (ar
) J(t
); }
69 void f(const bool &t
) { new (ar
) bool(t
); }
76 void f(J t
) { boolf(*t
.p
); }
83 Z(const Z
&other
) { other
.au(X(this)); }
85 void *c
= const_cast<Z
*>(this);
87 t
.f(*static_cast<J
*>(c
));
89 t
.f(*static_cast<bool *>(c
));
93 void *c
= const_cast<Z
*>(this);
95 t
.f(*static_cast<J
*>(c
));
107 } // namespace pr37802_v2