Details
-
Bug
-
Resolution: Fixed
-
P4: Low
-
Qt Creator 4.10.1
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.