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

Complete Switch statement fails in some cases

    XMLWordPrintable

Details

    • 2798c11d1d0c0f08daebf6c26063ccb70766dc78 (qt-creator/qt-creator/5.0)

    Description

      The refactoring Complete Switch Statement fails in certain situations.

      Below you will find a simplified version of a enumCast function. In each of the cases try and press alt-enter after the switch statement. As the function name indicates it fails with the enumCast on a type that is inside a class.

       

      template <typename TYPE>
      TYPE enumCast(int value)

      { return static_cast<TYPE>(value); }

      enum class GlobalColumn { Foo, Bar, Baz };

      class Test

      { enum class Column \{ Foo, Bar, Baz }

      ;

      void bad(int i)
      {
      switch (enumCast<Column>) {
      }
      }

      void good(int i)
      {
      Column col = enumCast<Column>;
      switch (col) {
      }
      }

      void goodToo(int i)
      {
      switch (enumCast<GlobalColumn>) {
      }
      }
      }

      Attachments

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

        Activity

          People

            kandeler Christian Kandeler
            blackie Jesper K. Pedersen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes