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

User-defined literals are not correctly highlighted in QtCreator 6 beta1.

    XMLWordPrintable

    Details

    • Commits:
      a3af941adf (qt-creator/qt-creator/master) a3af941adf (qt-creator/qt-creator/qmlprojectstorage)

      Description

      Use defined literal operator with const char* string literals are not correctly syntax-highlighted in 6.0.0 beta1. It was correct in QtCreator5 and 4.x

      What it looks like in 6 beta1 (notice the "length tst"_len in line 16)

       

      What it looks like in 5

       

       The reproducing code is attached below.

      #include <cstring>
      #include <iostream>
      
      size_t operator""_len(const char *, size_t length)
      {
          return length;
      }
      
      size_t getLength(const char *str)
      {
          return std::strlen(str);
      }
      
      int main(int, char *[])
      {
          const auto len = "length tst"_len; // This line shows the problem.
          const auto len2 = getLength("length tst");
      
          len, len2;
      }

        Attachments

        For Gerrit Dashboard: QTCREATORBUG-26425
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            kandeler Christian Kandeler
            Reporter:
            leroy Haoyu Liu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes