Make share/qtcreator/cplusplus/examples compilable

Builds now, but does not link (which is fine). And unrelated,
unintentional warnings were removed.

Change-Id: I6ece33933bc20e6e36fb3859de7c2b774b0e67d5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Alessandro Portale
2022-02-04 12:15:45 +01:00
parent 96ec295fc6
commit 08535a7e63
4 changed files with 23 additions and 23 deletions

View File

@@ -71,7 +71,7 @@ public:
// misc-noexcept-move-constructor
// misc-unconventional-assign-operator
// misc-unused-parameters
Base operator=(Base &&param) {}
Base operator=(Base &&param) { return {}; }
virtual int function()
{
// modernize-use-nullptr
@@ -116,7 +116,7 @@ void afterMove(Base &&base)
Base moved(std::move(base));
// misc-use-after-move
base.value;
(void) base.value;
}
// google-runtime-references
@@ -144,7 +144,7 @@ public:
auto b = {0.5f, 0.5f, 0.5f, 0.5f};
// misc-fold-init-type
std::accumulate(std::begin(b), std::end(b), 0);
(void) std::accumulate(std::begin(b), std::end(b), 0);
// google-readability-casting, misc-incorrect-roundings
auto c = (int)(getDouble() + 0.5);
@@ -197,6 +197,7 @@ public:
std::system("echo ");
// cert-err52-cpp
setjmp(nullptr);
return 0;
}
// google-default-arguments
@@ -251,7 +252,7 @@ int main()
// modernize-loop-convert
for (int i = 0; i < 3; ++i) {
// cppcoreguidelines-pro-bounds-constant-array-index
arr[i];
(void) arr[i];
}
std::vector<std::pair<int, int>> w;