-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoExplicitConstructor.cpp
More file actions
38 lines (31 loc) · 904 Bytes
/
noExplicitConstructor.cpp
File metadata and controls
38 lines (31 loc) · 904 Bytes
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
// Copyright Glen Knowles 2017 - 2021.
// Distributed under the Boost Software License, Version 1.0.
//
// a.cpp - bugs cppcheck-1.81
#include <string_view>
#include <functional>
using namespace std;
class ITaskNotify {
public:
virtual ~ITaskNotify() = default;
virtual void onTask() { delete this; }
private:
friend class TaskQueue;
ITaskNotify * m_taskNext{nullptr};
};
class RunOnceTask : public ITaskNotify {
public:
RunOnceTask(string_view name, function<void()> && fn);
private:
void onTask() override;
function<void()> m_fn;
};
/*
I'd like to report a false positive, and the wiki sent me here to get an
account.
This constructor: RunOnceTask(string_view name, function<void()> && fn);
Results in: Class 'RunOnceTask' has a constructor with 1 argument that is not
explicit. A complete cpp containing this can be found at:
https://godbolt.org/g/HGtn5R
Thanks.
*/