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

C++ parsing fails with C++11 QStringLiteral

    XMLWordPrintable

Details

    • 23c637c4f677ab2f19793f409297b0131b21dcaa

    Description

      When a QStringLiteral is found in the source code in C+11 mode (the qmake mkspec has -std=c0x), the C+ parser stops working.

      Example:

      #include <QString>
      
      static inline quint8 fromHex(quint8 c)
      {
          c |= 0x20;
          return c >= 'a' ? c - 'a' + 10 : c - '0';
      }
      
      static inline QString ftpScheme()
      {
          return QStringLiteral("ftp");
      }
      
      static inline QString httpScheme()
      {
          return QStringLiteral("http");
      }
      
      static inline int foo() { return 1; }
      

      Put the above in a C++ source code, make sure the toolchain is configured for C++11 mode and press Ctrl+K,. (dot). It should list four functions, but it only lists the first two. The problem seems to be the parsing of the expansion of QStringLiteral.

      The above code was copied from qurl.cpp from qtbase. You can use that file as an example of this problem. After the first QStringLiteral, the C++ support is simply non-existent. Not only are functions not found, but all expansion provided by Ctrl+Space is gone in 2.5.

      Attachments

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

        Activity

          People

            leamelo Leandro T. C. Melo
            thiago Thiago Macieira
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes