Bug 279728 - auto-keyword and range-based for loops
Summary: auto-keyword and range-based for loops
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: git master
Platform: Unlisted Binaries Linux
: NOR minor
Target Milestone: 4.2.3
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-09 11:21 UTC by Jörg Pfähler
Modified: 2013-03-31 00:52 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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