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

Segfault when right-clicking on erroneous code in function definition

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • Qt Creator 4.2.0-rc1
    • Qt Creator 4.1.0
    • C/C++/Obj-C++ Support
    • None
    • Linux x86_64 (Arch Linux)

    Description

      I have encountered a crash with the following code:

      container.h
      #include <vector>
      
      std::vector<int> vec;
      
      void myfunc()
      some_text
      {
        for (int element : vec) {
      
        }
      }
      

      The function definition is incorrect and causes the line for (int element : vec) { to be underlined in yellow, which is expected. However, if I right-click this line, QtCreator crashes.

      Steps to reproduce :

      • Create a new project: "Plain C++ Application", with qmake build system (I've had the issue with CMake as well so I don't think it matters)
      • Create a new class with any name
      • Remove the class declaration code in the class header file, and replace it with the code above
      • Right-click on the for line.

      The function isn't declared nor defined anywhere else.
      The crash doesn't happen if I remove the for's braces.
      The crash only happens in header files that have been created using "New C++ Class".

      I have included a stack trace.
      Feel free to ask for details if needed.

      Attachments

        1. crashtest.pro
          0.1 kB
        2. trace.log
          3 kB

        Issue Links

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

          Activity

            People

              kosjar Nikolai Kosjar
              ranjak Hector Labanca
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes