I'm using KDevelop git master (2012-05-03). Consider the following example: #include <QVector> void func() { QVector<double> vec; for (auto elem : vec) { // popup says elem is int } } The popup says "elem" variable is of type "int", when in fact it should be double&. Note that this problem occurs with QVector, QSet, etc..., but not with std::vector, std::list, etc... Thanks Reproducible: Always Steps to Reproduce: 1. Try the code above. Actual Results: Invalid type is deduced. Expected Results: Correct type should be deduced. openSUSE 12.1 x86-64, KDE 4.7.2.
Git commit 25c9de709d85f6288ea2dcc68ee2ef15125015be by Milian Wolff. Committed on 14/05/2012 at 21:16. Pushed by mwolff into branch '4.3'. Fix begin-lookup for auto-type deduction in range-based for loops. First up, ensure we pick the proper list type by introducing a virtual ContextBuilder::handleRangeBasedFor that is then overwritten in the DeclarationBuilder. This way we can ensure that lastType() actually returns the type we want. Then, when we don't find a viable begin function in the current namespace via ADL, fallback to ::std::begin (in accordance to the spec) and repeat. M +7 -2 languages/cpp/cppduchain/contextbuilder.cpp M +1 -0 languages/cpp/cppduchain/contextbuilder.h M +39 -8 languages/cpp/cppduchain/declarationbuilder.cpp M +1 -1 languages/cpp/cppduchain/declarationbuilder.h M +0 -1 languages/cpp/cppduchain/overloadresolutionhelper.cpp M +1 -0 languages/cpp/cppduchain/tests/test_duchain.h M +62 -0 languages/cpp/cppduchain/tests/test_duchain_cpp2011.cpp http://commits.kde.org/kdevelop/25c9de709d85f6288ea2dcc68ee2ef15125015be