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

Autocompletion suggests default constructor instead of class name

    XMLWordPrintable

Details

    • Linux/X11

    Description

      Try typing this piece of code:

      namespace my_ns {
      template< typename T >
      class my_type1
      {
      public:
      	my_type1() = default;
      };
      }
      
      class my_type2 :
      	public my_ns::my_
      

      While typing the last line, pay attention to the autocompletion suggestion QtCreator presents. In my case, the autocompletion list includes my_type1 (the default constructor), my_type1 (the class name), my_ns and my_type2. The default constructor entry is the first in the list and selected by default, so pressing Enter completes the code incorrectly:

      class my_type2 :
      	public my_ns::my_type1()
      

      I noticed that the default constructor entry is not present if my_type1 is not in my_ns but in the global namespace (i.e. when you're typing "public my_" in the last line).

      This kind of problem is present not only when typing base classes, but also in other contexts that trigger autocompletion.

      I would prefer if constructors were not present in the autocompletion list. At least, not when a type name is expected. Or at all, if detecting the current context is not possible. Note that autocompleting to the class name is also fitting in contexts where a constructor name is expected.

      Attachments

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

        Activity

          People

            kandeler Christian Kandeler
            lastique Andrey Semashev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes