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

Compile errors on msvc2008 relating to std::lower_bound

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.2.0
    • 5.2.0
    • None
    • VC2008 (no IDE, compiler came from the Windows SDK), debug mode, Windows 7.
    • f4cc344e01e00e640bce10f03c47b25d19c3e7fc c40a48af997f57caa0ecfca0b247837ba5b2f89b 1985f818e7c543393660c50dccfb078d9f3c4501

    Description

      In MSVC2008, debug mode enables several extra checks in the STL, such as checking that the range passed to std::lower_bound is actually sorted. The following code would usually only need operator<(Foo,Bar), but in VC2008 debug mode it also requires operator<(Bar,Foo) and operator<(Foo,Foo):

      SomeContainer<Foo> v;
      Bar x;
      std::lower_bound(begin(v), end(v), x);
      

      In 23d7f6ee, qBinaryFind was changed to use std::lower_bound instead of qLowerBound. This broke the build in several places, for example this error in tools/qregexp.cpp:3248:

      error C2678: binary '<' : no operator found which takes a left-hand operand of type 'const CategoriesRangeMapEntry' (or there is no acceptable conversion) while trying to match the argument list '(const CategoriesRangeMapEntry, const CategoriesRangeMapEntry)'

      where only operator<(CategoriesRangeMapEntry, const char*) and operator<(const char*, CategoriesRangeMapEntry) are defined.

      None of this happens when compiling in release mode.

      Very related bug: QTBUG-27419

      Attachments

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

        Activity

          People

            nalvarez Nicolás Alvarez
            nalvarez Nicolás Alvarez
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes