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

qBound: compile error with some parameter combinations

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.9
    • None

    Description

      these statements compile:

      qBound(0.0, 0.5, 1.0);
      qBound(0.0, 0.5f, 1.0);
      qBound<float>(0, 0.5f, 1);
      

      however this does not compile:

      qBound<float>(0.0, 0.5f, 1.0);
      qBound(0, 0.5, 1);
      qBound(0, 0.5f, 1)
      

      furthermore the documentation only states the signature:

      template <typename T> const T &qBound(const T &min, const T &val, const T &max)
      

      while we have implementations of different signatures (which cause the above compile errors due to ambiguities).

      ideally we'd have the expected behaviour that:

      • qBound(a, b, c) would return decltype(b)
      • qBound<T>(a, b, c) would ensure a return type of T

      Attachments

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              timblechmann tim blechmann
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change