[Development] Proposal: adding Q_DECL_NOEXCEPT to many methods

Marc Mutz marc.mutz at kdab.com
Fri Aug 3 18:52:36 CEST 2012


On Friday August 3 2012, Thiago Macieira wrote:
> On quinta-feira, 2 de agosto de 2012 23.57.58, Marc Mutz wrote:
> > noexcept(std::declval<Object>().f()) should work.
>
> Unfortunately, while the C++11 compiler support seems to be going fine, the
> library support is lagging WAY behind.  Add to that the fact that some
> compilers are being used with incompatible Standard Libraries, meaning the
> features don't work, even if present. To make it all worse, there are no
> library version numbers, so we can't detect them properly.
>
> Exhibit A: MSVC supports initialiser lists, but it doesn't have
> <initializer_list>...
>
> Exhibit B: ICC compiling certain GCC headers will cause it to fail to link
> complaining about undefined references to functions that should be
> intrinsics.

namespace QtPrivate {
#ifdef Q_COMPILER_RVALUE_REFS
    template <typename T>
    typename remove_reference<T>::type&& declval() Q_DECL_NOEXCEPT;
#else
    template <typename T>
    typename remove_reference<T>::type& declval() Q_DECL_NOEXCEPT;
#endif
}

left undefined, should be equivalent.

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions



More information about the Development mailing list