diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-08-01 16:10:40 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2014-08-09 15:35:59 +0200 |
commit | e319196f7634825c6f8f6694dbc42f0ee52a1ce8 (patch) | |
tree | 83af03c413dacdfd897c7bdbf9dc39e2bea31d86 /tests | |
parent | 65ade55c8cf89db0bb6efbda7e9a2f9443398f5d (diff) |
Ensure that qCleanupFuncinfo works with some C++11 new constructs
This commit adds tests for ref-qualified member functions, the new
syntax for functions and decltype.
__PRETTY_FUNCTION__ for lambdas varies wildly between compilers and will
produce really bizarre results after cleanup. It's not tested and is
known to be broken.
Change-Id: I70c8dbcba54790357cecba35aa45c5cc672f29d1
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/global/qlogging/test/test.pro | 1 | ||||
-rw-r--r-- | tests/auto/corelib/global/qlogging/tst_qlogging.cpp | 36 |
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/corelib/global/qlogging/test/test.pro b/tests/auto/corelib/global/qlogging/test/test.pro index c75fc47f96..788a2064cd 100644 --- a/tests/auto/corelib/global/qlogging/test/test.pro +++ b/tests/auto/corelib/global/qlogging/test/test.pro @@ -1,5 +1,6 @@ CONFIG += testcase parallel_test CONFIG -= app_bundle debug_and_release_target +contains(QT_CONFIG, c++11): CONFIG += c++11 c++14 TARGET = ../tst_qlogging QT = core testlib SOURCES = ../tst_qlogging.cpp diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index ccf0d2d4a8..ebfab643bd 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -242,6 +242,26 @@ public: int &operator--() { ADD("TestClass1::operator--"); return x; } int operator--(int) { ADD("TestClass1::operator--"); return 0; } +#ifdef Q_COMPILER_REF_QUALIFIERS + int lvalue() & { ADD("TestClass1::lvalue"); return 0; } + int const_lvalue() const & { ADD("TestClass1::const_lvalue"); return 0; } + int rvalue() && { ADD("TestClass1::rvalue"); return 0; } + int const_rvalue() const && { ADD("TestClass1::const_rvalue"); return 0; } +#endif +#ifdef Q_COMPILER_DECLTYPE + int decltype_param(int x = 0, decltype(x) = 0) { ADD("TestClass1::decltype_param"); return x; } + template<typename T> int decltype_template_param(T x = 0, decltype(x) = 0) + { ADD("TestClass1::decltype_template_param"); return x; } + template<typename T> void decltype_template_param2(T x, decltype(x + QString())) + { ADD("TestClass1::decltype_template_param2"); } +# ifdef Q_COMPILER_AUTO_FUNCTION + auto decltype_return(int x = 0) -> decltype(x) + { ADD("TestClass1::decltype_return"); return x; } + template <typename T> auto decltype_template_return(T x = 0) -> decltype(x) + { ADD("TestClass1::decltype_template_return"); return x; } +# endif +#endif + public: TestClass1() { @@ -287,6 +307,22 @@ public: operator++(0); operator--(); operator--(0); + +#ifdef Q_COMPILER_REF_QUALIFIERS + lvalue(); + const_lvalue(); + std::move(*this).rvalue(); + std::move(*this).const_rvalue(); +#endif +#ifdef Q_COMPILER_DECLTYPE + decltype_param(); + decltype_template_param(0); + decltype_template_param2(QByteArray(), QString()); +# ifdef Q_COMPILER_AUTO_FUNCTION + decltype_return(); + decltype_template_return(0); +# endif +#endif } }; |