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

Anonymous union confuses code model

    XMLWordPrintable

    Details

    • Commits:
      74177a559e16c5c260d8934a7f5a7a959e4565b3 (qt-creator/qt-creator/master)

      Description

      Consider the following code snippet:

      struct S {
          union  {
              int i = 12;
              void *something;
          };
          int func(bool b) {
              if (b)
                  return i; // <-- here
              int i = 42;
              return i;
          }
      };
      

      In the marked line, i is not colored as a member variable; moreover go-to-definition will jump to the local definition of i, instead of to the one inside the union.

      If the union is replaced with a simple member i, or if this->i is used instead of i, everything works as expected.

        Attachments

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

          Activity

            People

            Assignee:
            kandeler Christian Kandeler
            Reporter:
            fabiankosmale Fabian Kosmale
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes