summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/q23utility.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global/q23utility.cpp')
-rw-r--r--src/corelib/global/q23utility.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/corelib/global/q23utility.cpp b/src/corelib/global/q23utility.cpp
new file mode 100644
index 0000000000..9c5365c547
--- /dev/null
+++ b/src/corelib/global/q23utility.cpp
@@ -0,0 +1,25 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QtCore/q23utility.h>
+
+QT_BEGIN_NAMESPACE
+
+#define CHECK2(cvref_in, cvref_out) \
+ static_assert(std::is_same_v< \
+ decltype(q23::forward_like<int cvref_in >(std::declval<long&>())), \
+ long cvref_out \
+ >, "oops: cvref '" #cvref_in "' doesn't work") \
+ /* end */
+#define CHECK(cvref) CHECK2(cvref, cvref)
+CHECK2(/**/, &&);
+CHECK(&);
+CHECK(&&);
+CHECK2(const, const &&);
+CHECK(const &);
+CHECK(const &&);
+// volatile is not supported
+#undef CHECK
+#undef CHECK2
+
+QT_END_NAMESPACE