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

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

    XMLWordPrintable

Details

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

    Description

      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).

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes