From e319196f7634825c6f8f6694dbc42f0ee52a1ce8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 1 Aug 2014 16:10:40 -0700 Subject: 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 --- .../auto/corelib/global/qlogging/tst_qlogging.cpp | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests/auto/corelib/global/qlogging/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 int decltype_template_param(T x = 0, decltype(x) = 0) + { ADD("TestClass1::decltype_template_param"); return x; } + template 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 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 } }; -- cgit v1.2.3