Bug 268539 - For-loop of C++0X
Summary: For-loop of C++0X
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: 4.2.0
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: 4.2.0
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-15 09:34 UTC by David Lanzendörfer
Modified: 2011-05-31 19:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
That's how far I got (2.86 KB, patch)
2011-03-15 09:34 UTC, David Lanzendörfer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Lanzendörfer 2011-03-15 09:34:55 UTC
Created attachment 58014 [details]
That's how far I got

Version:           4.2.0 (using KDE 4.6.1) 
OS:                Linux

Hello. I'm using gcc-4.6 in order to use easier access to list containers.
Sadly KDevelop doesn't recognize the additional possible syntax.
I tried to introduce it to languages/cpp/parser/parser.cpp but...
Well, I don't know the code enough to make usable changes...
Tree theory never was my preferred lecture anyway so lexers are pain ^_^"
Could someone please implement this?
Thx.

Reproducible: Always

Steps to Reproduce:
list<T> tlist;
for(T& object : tlist) { cout << object << endl;}

Actual Results:  
Expected token ';' after identifier' found ':'

Expected Results:  
Autocompletition and further loop parsing and this stuff

I wrote a patch, but I don't get further then this.
Perhaps someone who knows this code better then me can get it working.
Comment 1 Milian Wolff 2011-03-15 22:46:46 UTC
please add links to the specification explaining the new syntax and how it is supposed to be handled.
Comment 2 David Lanzendörfer 2011-03-15 23:14:21 UTC
(In reply to comment #1)
> please add links to the specification explaining the new syntax and how it is
> supposed to be handled.

Thank you for your answer.

Here is the PDF with the syntactical description:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2049.pdf
Comment 3 Milian Wolff 2011-05-31 13:05:48 UTC
just pushed this to the c++0x branch, once the TODOs are resolved it will be merged into master.

commit 20af607a58ec76aab228244570c983667b5d01d5
Author: Milian Wolff <mail@milianw.de>
Date:   Tue May 31 13:04:08 2011 +0200

    add parser support for range-based for
    
    TODO: unit test for code generation
    TODO: duchain integration + unit test on that side
Comment 4 Milian Wolff 2011-05-31 19:22:38 UTC
seems to work now