[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Analysis / PR46264.cpp
blobc132e6a3171396179d4f97324608cc04546d529a
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
3 // rdar://problem/64202361
5 struct A {
6 int a;
7 struct {
8 struct {
9 int b;
10 union {
11 int c;
17 int testCrash() {
18 int *x = 0;
19 int A::*ap = &A::a;
21 if (ap) // no crash
22 return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
24 return 10;
27 int testIndirectCrash() {
28 int *x = 0;
29 int A::*cp = &A::c;
31 if (cp) // no crash
32 return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
34 return 10;
37 // PR46264
38 // This case shall not crash with an assertion failure about void* dereferening.
39 namespace ns1 {
40 namespace a {
41 class b {
42 public:
43 typedef int b::*c;
44 operator c() { return d ? &b::d : 0; }
45 int d;
47 } // namespace a
48 using a::b;
49 class e {
50 void f();
51 void g();
52 b h;
54 void e::f() {
55 e *i;
56 if (h)
57 i->g(); // expected-warning{{Called C++ object pointer is uninitialized}}
59 } // namespace ns1