Page 1 of 1

Auto completion bug with curly-initialized class members

Posted: Thu Nov 08, 2012 8:31 pm
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.

Re: Auto completion bug with curly-initialized class members

Posted: Thu Nov 08, 2012 10:21 pm
by Jarod42

Code: Select all

vector<int> doesntwork { 0 };
is not a valid declaration.

Re: Auto completion bug with curly-initialized class members

Posted: Thu Nov 08, 2012 10:51 pm
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 "= ...;".

Re: Auto completion bug with curly-initialized class members

Posted: Fri Nov 09, 2012 12:12 am
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.

Re: Auto completion bug with curly-initialized class members

Posted: Fri Nov 09, 2012 12:23 am
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?

Re: Auto completion bug with curly-initialized class members

Posted: Fri Nov 09, 2012 2:33 am
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.

Re: Auto completion bug with curly-initialized class members

Posted: Mon Nov 12, 2012 7:57 pm
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.

Re: Auto completion bug with curly-initialized class members

Posted: Mon Nov 12, 2012 11:40 pm
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

Re: Auto completion bug with curly-initialized class members

Posted: Wed Nov 14, 2012 5:15 pm
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.

Re: Auto completion bug with curly-initialized class members

Posted: Wed Nov 14, 2012 6:10 pm
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