Bug 279728

Summary: auto-keyword and range-based for loops
Product: kdevelop Reporter: Jörg Pfähler <bluecoder>
Component: Language Support: CPP (old)Assignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: minor CC: job
Priority: NOR    
Version: git master   
Target Milestone: 4.2.3   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:

Description Jörg Pfähler 2011-08-09 11:21:14 UTC
Version:           git master (using KDE 4.7.0) 
OS:                Linux

in the following code kdevelop classifies iter as an "int":

std::vector<char> v;
for (auto iter : v);

This happens independent of the type of the vector (I discovered it with std::shared_ptr).

Reproducible: Always

Steps to Reproduce:
-


Expected Results:  
-
Comment 1 Milian Wolff 2011-11-24 18:36:05 UTC
Git commit 136bf571f3b2f6ddb8369dc8576605650924c5fa by Milian Wolff.
Committed on 24/11/2011 at 19:30.
Pushed by mwolff into branch 'master'.

c++2011 support: proper type deduction in auto range-based-for

for c-arrays we take the element type
for all other types we look via ADL for begin(listType)
and then dereference the return type of that function

See 6.5.4 in the C++2011 spec

BUG: 279728

M  +13   -4    languages/cpp/cppduchain/contextbuilder.cpp
M  +49   -2    languages/cpp/cppduchain/declarationbuilder.cpp
M  +2    -0    languages/cpp/cppduchain/declarationbuilder.h
M  +1    -0    languages/cpp/cppduchain/tests/test_duchain.h
M  +54   -0    languages/cpp/cppduchain/tests/test_duchain_cpp2011.cpp
M  +5    -0    languages/cpp/cppduchain/typebuilder.cpp
M  +3    -0    languages/cpp/cppduchain/typebuilder.h

http://commits.kde.org/kdevelop/136bf571f3b2f6ddb8369dc8576605650924c5fa
Comment 2 Aleix Pol 2013-03-31 00:52:41 UTC
Moving all the bugs from the CPP Parser. It was not well defined the difference between it and C++ Language Support and people kept reporting in both places indistinctively