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

Consider implementing clazy warning for implicit construction of QVariant(bool)

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • None
    • Core: Other
    • None

      Given a function returning QVariant, if you accidentally `return false` it will silently construct and return a QVariant containing a bool with the value `false`. In modern C++ this could be written as `return

      {false}

      ` if it was actually intentional.

      Having a warning + fixit in tooling like Clazy would make this easily discoverable.
      As a bonus, detect implicit conversion from types with implicit conversion to bool, like smart pointers (see QTBUG-43358).

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            cnn Qt Core & Network
            manordheim MÃ¥rten Nordheim
            Vladimir Minenko Vladimir Minenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes