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

qBound: compile error with some parameter combinations

XMLWordPrintable

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

      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

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

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

              Created:
              Updated:

                There is 1 open Gerrit change