summaryrefslogtreecommitdiff
path: root/tests/assertion-extraction-cpp.cpp
blob: 8d52f0cee7d0ac055e9ea1517aabe72a30988142 (plain)
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
/* Template: assertion */

/*
 * null passed to a callee that requires a non-null argument
 *         assertion_func (NULL, 1, obj);
 *                         ~~~~        ^
 * null passed to a callee that requires a non-null argument
 *         assertion_func (NULL, 3, NULL);
 *                         ~~~~         ^
 */
{
    struct Temp {
        operator bool () { return true; }
        ~Temp () {}
    };
    g_return_if_fail (Temp () && some_str);
}

/*
 * null passed to a callee that requires a non-null argument
 *         assertion_func (NULL, 1, obj);
 *                         ~~~~        ^
 * null passed to a callee that requires a non-null argument
 *         assertion_func (NULL, 3, NULL);
 *                         ~~~~         ^
 */
{
    try {
        g_return_if_fail (some_str);
    } catch (...) {
    }
}