summaryrefslogtreecommitdiff
path: root/test/test21.cpp
blob: 7b12ee2907f1decfee368bf381df4c2668253f8f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <vector>

struct Data1
{
    int val;
};

int k;

class Object1
{
    int func1(void *ptr1)
    {
        int tmpvar = 0;
        Data1 *const ptr2 = static_cast<Data1*>(ptr1);

        if (!ptr1)
        {
            return 0;
        }

        if (ptr2->val)
        {
            return 3;
        }
        return 0;
    }

    int func2(void *ptr1)
    {
        int attempts = 0;
        Data1 *const ptr2 = reinterpret_cast<Data1*>(ptr1);

        if (!ptr2)
            return 0;

        int outFilename = ptr2->val;
    }

    int func3(void *ptr1)
    {
        if (!ptr1)
            return 1;

        Data1 *const ptr2 = reinterpret_cast<Data1*>(ptr1);
        int val = ptr2->val;
    }

    int func4(Data1 *const ptr1)
    {
        const Data1 *ptr2 = static_cast<Data1*>(0);
        if (ptr1 && ptr2)
        {
            int k = ptr1->val;
        }
    }

    int func5(Data1 *const ptr1)
    {
        const Data1 *ptr2 = static_cast<Data1*>(0);
        int z;
        if (ptr2 && ptr1 && z == 12)
        {
            const Data1 *const ptr3 = reinterpret_cast<const Data1* const>(ptr2);
            if (ptr3)
            {
                if (ptr1->val == 10)
                {
                    int k2 = ptr1->val + 1;
                }
            }
        }
    }

    int func6(Data1 *const ptr1)
    {
        const Data1 *ptr2 = static_cast<Data1*>(0);
        if (ptr2 && ptr1 && k == 10)
        {
            k = ptr1->val;
        }
    }
};