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

Clang: Highlighting of argument to user defined index operator is wrong

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P3: Somewhat important
    • None
    • Qt Creator 3.6.0
    • C/C++/Obj-C++ Support

    Description

      struct Foo {
          Foo &operator[](int key);
      };
      
      void failsHere()
      {
          const int index = 3;
          Foo foo;
          foo[index]; // Ops, "index" is highlighted as "function"
      }
      
      void worksAsExpectedHere()
      {
          const int index = 3;
          int foo[100];
          foo[index]; // OK, "index" is highlighted as "local variable".
      }
      

      This is a libclang bug, re-producible with libclang 3.6 and the current (not yet released) 3.8.

      Underlying issue seems to be that the "referenced cursor" for "index" is of kind CXCursor_CXXMethod, not CXCursor_VarDecl.

      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
              kosjar Nikolai Kosjar
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes