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

[REG 4.3 -> 4.4] Clang: "Extract function" generates syntax error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • Qt Creator 8.0.0-beta1
    • Qt Creator 4.4.0-beta1, Qt Creator 4.5.0, Qt Creator 4.10.0-rc1
    • C/C++/Obj-C++ Support
    • Ubuntu 16.04 64 bit
      Windows 10 1709 64 bit
    • 840263eb9a7687f2c0ecd9b0503d355fad5bac5e

    Description

      1. Start Creator with enabled Clang Code Model.
      2. Have some simple lines of code:
            int dummy = 0;
            if (dummy < 10)
                ++dummy;
        
      3. Select the "if".
      4. Right click into the editor and select "Refactor" -> "Extract Function" from the context menu.
      5. Enter a name for the function and click "OK".
        The generated function will look like this:
        void functionName()
        {
            if (dummy < 10)
                ++dummy;    
        }
        

        This is syntactically incorrect because dummy is undeclared.

      In Creator 4.3 this works correctly as well as with the built-in code model: They make the used variable an input parameter to the function.

      Found and tested by Squish test tst_CSUP03.

      Attachments

        Issue Links

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

          Activity

            People

              kosjar Nikolai Kosjar
              rlohning Robert Löhning
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes