blob: 6a4a0a15ab71549af50b6ff4be80468f2103044b (
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
|
// https://clang.llvm.org/extra/clang-tidy/checks/bugprone-unused-raii.html
struct scoped_lock
{
scoped_lock() {}
~scoped_lock() {}
};
#define SCOPED_LOCK_MACRO(m) scoped_lock()
struct trivial_scoped_lock
{
trivial_scoped_lock() {}
};
scoped_lock test()
{
scoped_lock(); // misc-unused-raii warning!
SCOPED_LOCK_MACRO(); // no warning for macros
trivial_scoped_lock(); // no warning for trivial objects without destructors
return scoped_lock(); // no warning for return values
}
|