Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-5122

Expression with a ternary operator (?:) marked as Error although it is correct

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Not Evaluated Not Evaluated
    • Qt Creator 2.4.0
    • Qt Creator 2.1.0, Qt Creator 2.2.0
    • C/C++/Obj-C++ Support
    • None
    • Windows XP (QtCreator 2.2.0) and Linux (QtCreator 2.1.0)
    • 89ac110ab066f3183725f574a237f9ef4c92192f

      The return statement of the following function is marked as erroneous (expected token ':' got '>'). But it is correct and works:

      static bool smallerWithCustomEpsilon(double a, double b, double epsilon) {
      return a < b ? std::abs(b - a) > epsilon : false;
      }

      There is a very smilar bug (QTCREATORBUG-1511) that has already been fixed.

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

            leamelo Leandro T. C. Melo
            peterbraun Peter Braun
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes