Bug 306771 - Do not show deleted methods in code completion
Summary: Do not show deleted methods in code completion
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Unclassified
Component: Language Support: CPP (old) (show other bugs)
Version: 4.3.1
Platform: openSUSE RPMs Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-13 21:20 UTC by Rolf Eike Beer
Modified: 2015-11-27 20:26 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch with fix and testcase (2.56 KB, patch)
2013-10-09 20:16 UTC, Rolf Eike Beer
Details
Suppress deleted constructors when trying to create an object (4.74 KB, patch)
2013-10-10 21:47 UTC, Rolf Eike Beer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rolf Eike Beer 2012-09-13 21:20:02 UTC
If I explicitely delete e.g. a constructor it is still shown in code completion (as private). It should not be shown there at all because there is no way even for a friend class or the same class to make valid use of this.

Reproducible: Always
Comment 1 Aleix Pol 2013-02-27 17:40:35 UTC
That's not correct.
You can use private constructors to create class's instances within the class.
Comment 2 Rolf Eike Beer 2013-02-27 18:15:48 UTC
Ehm, no. If it's deleted it is not there. It's not about foo::foo(), but about bar::bar():

class foo {
  foo();
}

class bar {
  bar() = delete;
}

bar::bar() can't ever exist, any try of using it would result in a linker error.
Comment 3 Aleix Pol 2013-03-31 01:40:04 UTC
It's C++ things, so put it under C++
Comment 4 Rolf Eike Beer 2013-10-09 20:16:59 UTC
Created attachment 82756 [details]
Patch with fix and testcase
Comment 5 Milian Wolff 2013-10-10 14:36:53 UTC
Git commit 17162ec728f33244eee7947a723763625633c2fe by Milian Wolff, on behalf of Rolf Eike Beer.
Committed on 09/10/2013 at 16:39.
Pushed by mwolff into branch '4.5'.

do not offer explicitely deleted methods for code completion

Again basically done by Milian.

M  +4    -0    languages/cpp/codecompletion/context.cpp
M  +8    -1    languages/cpp/tests/test_cppcodecompletion.cpp

http://commits.kde.org/kdevelop/17162ec728f33244eee7947a723763625633c2fe
Comment 6 Rolf Eike Beer 2013-10-10 21:45:54 UTC
Seems to be only half of the story. When trying to call a constructor e.g. like below the deleted methods still show up:

A *a = new A(
Comment 7 Rolf Eike Beer 2013-10-10 21:47:10 UTC
Created attachment 82779 [details]
Suppress deleted constructors when trying to create an object
Comment 8 Rolf Eike Beer 2013-10-11 21:36:32 UTC
Git commit dfae4bbc1f4a83f71e69dd162573f9b51c8b2c49 by Rolf Eike Beer.
Committed on 10/10/2013 at 21:42.
Pushed by dakon into branch '4.5'.

when calling a constructor don't offer deleted ones for completion

M  +4    -1    languages/cpp/cppduchain/overloadresolution.cpp
M  +66   -0    languages/cpp/tests/test_cppcodecompletion.cpp
M  +2    -0    languages/cpp/tests/test_cppcodecompletion.h

http://commits.kde.org/kdevelop/dfae4bbc1f4a83f71e69dd162573f9b51c8b2c49