Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-130888

Incorrect formulation of conditonal noexcept \note's

    XMLWordPrintable

Details

    • DaVinci 108

    Description

      Example: https://doc.qt.io/qt-6/qspan.html#first (in case the link changed in the meantime, this is the template <std::size_t Count> auto QSpan::first() const function).

      The auto-generated \note about the conditional noexcept reads:

      This function does not throw any exception when "subspan_always_succeeds_v<Count>" is true.

      First, the condition should be in fixed-width type, not in ":

      This function does not throw any exception when subspan_always_succeeds_v<Count> is true.

      The main point, however, is that noexcept doesn't mean "does not throw exception". It means that it's noexcept, meaning if an exception is thrown while executing the function (or any of its callees), the stack is not unwound, but std::terminate() is called immediately.

      So the \note is wrong.

      Suggested reading:

      This function is noexcept when subspan_always_succeeds_v<Count> is true.

      If there's a desire to do so, we can then make the "noexcept" in the note be a link to either https://en.cppreference.com/w/cpp/language/noexcept_spec or a page of our own.

      Attachments

        For Gerrit Dashboard: QTBUG-130888
        # Subject Branch Project Status CR V

        Activity

          People

            david.boddie David Boddie
            mmutz Marc Mutz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change