Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
Qt Creator 4.10.0-beta2
-
None
Description
Creator (the Clang code model plugin is enabled) can not highlight "par" in the following code:
if (auto* par = obj.parent(); par != nullptr) {
par->setText(message);
}
Putting the text caret on "par" in the "auto* par" initializer will not highlight anything. Putting it on one of the other occurrences will highlight it and the occurrence within the if block, but not the occurrence in the initializer.
Refactoring has the same issue. You can't rename "par", unless you do it on the occurrence in the condition or in the body. And that will only rename those two but leave the occurrence in the initializer with the old name.
Switching to the experimental "ClangRefactoring" plugin helps a tiny bit with refactoring, as it will also rename the initializer occurrence when renaming that occurrence directly, but that will bring up the full "replace" UI instead of allowing you to rename it inline. When trying to rename one of the other occurrences will get you inline renaming, but this will leave the initializer occurrence untouched, just like without the ClangRefactoring plugin.
Highlighting still doesn't work even with the ClangRefactoring plugin.
All of the above also applies to C++17 switch statements with initializers.