Auto completion bug with curly-initialized class members

Discussion about CodeLite development process and patches
SuperV1234
CodeLite Enthusiast
Posts: 33
Joined: Thu Nov 08, 2012 2:23 am
Genuine User: Yes
IDE Question: c++
Contact:

Auto completion bug with curly-initialized class members

Post by SuperV1234 »

Example.h

Code: Select all

class Example {
    vector<int> works;
    vector<int> doesntwork { 0 };
}
If I use auto-completion in Example.cpp, I can find the member "works" in the list along with all of its members (push_back, size, etc..).
I can't find the member "doesntwork" in the auto-completion list. If I remove the curly brace initialization ({0}), then it shows up.
User avatar
Jarod42
CodeLite Expert
Posts: 240
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Auto completion bug with curly-initialized class members

Post by Jarod42 »

Code: Select all

vector<int> doesntwork { 0 };
is not a valid declaration.
SuperV1234
CodeLite Enthusiast
Posts: 33
Joined: Thu Nov 08, 2012 2:23 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: Auto completion bug with curly-initialized class members

Post by SuperV1234 »

Jarod42 wrote:

Code: Select all

vector<int> doesntwork { 0 };
is not a valid declaration.
It is in C++11, which is the current standard (approved, not experimental anymore).
It is also advised to use such syntax instead of round brace "(...);" initialization or copy initialization "= ...;".
User avatar
Jarod42
CodeLite Expert
Posts: 240
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Auto completion bug with curly-initialized class members

Post by Jarod42 »

Not valid as you wrote in the class.

But, to answer to your question,
you can enable clang completion in menu:
Settings... -> Tags settings.. -> clang -> Enable clang completion

and then it works for me.
SuperV1234
CodeLite Enthusiast
Posts: 33
Joined: Thu Nov 08, 2012 2:23 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: Auto completion bug with curly-initialized class members

Post by SuperV1234 »

Jarod42 wrote:Not valid as you wrote in the class.
Well obviously you'd have to #include <vector> and "using namespace std;". I left that out to make a shorter example.
The code I posted compiles properly in my workspace.
Jarod42 wrote:you can enable clang completion in menu:
Settings... -> Tags settings.. -> clang -> Enable clang completion

and then it works for me.
Compiling clang (and getting it to work) on Windows is quite hard. I've tried several times, and it never worked. Do you have a working MinGW+Clang distro?
User avatar
Jarod42
CodeLite Expert
Posts: 240
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Auto completion bug with curly-initialized class members

Post by Jarod42 »

I have no problem with Experimental Clang Binaries for Mingw32/x86 of http://llvm.org/releases/download.html#3.1.
See http://www.codelite.org/LiteEditor/ClangCompiler for more details.

Note that it is not needed for clang completion.
Codelite uses clang.dll (provided with codelite).
So just check the checkbox to use clang completion.


[Edit] Add wiki link.
SuperV1234
CodeLite Enthusiast
Posts: 33
Joined: Thu Nov 08, 2012 2:23 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: Auto completion bug with curly-initialized class members

Post by SuperV1234 »

I managed to get clang working, but the problem persists.
It also happens with code outline window (curly-initialized members aren't displayed at all!)

Can this issue be looked into? Curly-initialization is good practice and modern code should use it as much as possible.

Another bug: name refactoring doesn't work with curly-initialized class members.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Auto completion bug with curly-initialized class members

Post by eranif »

SuperV1234 wrote:Can this issue be looked into? Curly-initialization is good practice and modern code should use it as much as possible.
In general, bugs / features reported here (i.e. on the forum) tend to get lost..
Please post it @sourceforge as feature request

Make sure you create separate feature request for each report (i.e. don't create a single feature request for both changes you mentioned on this thread)
https://sourceforge.net/p/codelite/feature-requests/

Eran
Make sure you have read the HOW TO POST thread
SuperV1234
CodeLite Enthusiast
Posts: 33
Joined: Thu Nov 08, 2012 2:23 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: Auto completion bug with curly-initialized class members

Post by SuperV1234 »

I posted it here: https://sourceforge.net/p/codelite/bugs/846/

I messed up the formatting unfortunately. I posted it as a single bug report because I think the problems are really closely related, probably the code parser just being unable to parse the curly initialization correctly.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Auto completion bug with curly-initialized class members

Post by eranif »

SuperV1234 wrote:I posted it here: https://sourceforge.net/p/codelite/bugs/846/

I messed up the formatting unfortunately. I posted it as a single bug report because I think the problems are really closely related, probably the code parser just being unable to parse the curly initialization correctly.
Thanks for posting this in SF.

Eran
Make sure you have read the HOW TO POST thread
Post Reply