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

Incorrect detection of variable position in the code (which means also broken renaming refactoring)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • None
    • Qt Creator 3.4.0, Qt Creator 3.4.2, Qt Creator 3.5.0-beta1
    • C/C++/Obj-C++ Support
    • None
    • Any Windows, QtCreator 3.4.0 (but previous QtCreator versions had the bug)

    Description

      In the code like bellow the location of variable ii is incorrectly shifted somewhere next in the text. You can check location in QtCreator if set the cursor to definition of variable ii OR if you try to make renaming refactoring of ii variable (code will be broken ... non-compilable).

      #define sn             QString::number
      int main(int argc, char *argv[]) {
        int ii=1;
        qDebug() << "Тест" << QString::number(ii) << sn(ii) << QString::number(ii);
       return 0;
      }
      

      It seems that the bug happens IF
      1. variable in code placed after string literal like "Тест" in the example
      AND
      2. some letters of string must be non-English (UTF-8 coding is used).
      PLUS
      3. "macro-shortcut" of QString::number need to be used.

      In my projects there are a lot of places like this. Always afraid of using renaming refactoring of QtCreator because of this behavior (it breaks compilable state and I have to reconstruct the code manually after such renaming refactorings).

      Attachments

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

        Activity

          People

            kosjar Nikolai Kosjar
            progrev Prav Ogrev
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes