summaryrefslogtreecommitdiff
path: root/test/test25.cpp
blob: d50ec91e40046b1f37b1ae1c89bf7c3121734b35 (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
struct Data1;

struct Data1
{
    Data1()
    {
    }

    Data1(Data1 *ptr0) :
        ptrval(ptr0)
    {
    }

    int val;
    Data1 *ptrval;
    int arr[3];

    int ftest1()
    {
        return 1;
    }

    static int ftest2(Data1 *ptr0)
    {
        return 1;
    }
};

int k;

class Object1
{
    Data1 *ptrval;

    int test1(Data1 *const ptr1) __attribute__((nonnull (2)))
    {
        if (ptr1)
            return 1;
        else
            return 0;
    }

    void func1(Data1 *const ptr1)
    {
        test1(nullptr);
    }

    void func2(Data1 *const ptr1)
    {
        test1(ptr1);
    }

    void func3(Data1 *const ptr1)
    {
        ptrval = reinterpret_cast<Data1*>(1);
        test1(ptrval);
    }
};