| Summary: | dereferencing iterator results in "field could not be resolved" error | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Michal Spadlinski <spadlinski> | ||||||
| Component: | cdt-core | Assignee: | Markus Schorn <mschorn.eclipse> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Doug Schaefer <cdtdoug> | ||||||
| Severity: | minor | ||||||||
| Priority: | P3 | CC: | benshadwick, konstantin.stupnik | ||||||
| Version: | 8.0 | ||||||||
| Target Milestone: | 8.0 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 182718 [details]
c++ testcase
Test-case showing "field could not be resolved" problem
I cannot reproduce the problem. Most likely it depends on the specific system headers you are using. Please try the following: * Create a new project and try to reproduce the issue with the single test file. * In case the problem is still there, please run the preprocessor on the test file and attach the output (gcc -E -P test.cpp). I will try to reproduce the problem with that. (In reply to comment #2) > I cannot reproduce the problem. Most likely it depends on the specific system > headers you are using. Please try the following: > I'm using headers from MSVC 2005, maybe that's the problem. In "C/C++ General" -> "Paths and Symbols" -> Includes -> GNU C++ I'm adding include dir: MSVC8Location\VC\include > * Create a new project and try to reproduce the issue with the single test > file. done, again the same > * In case the problem is still there, please run the preprocessor on the test > file and attach the output (gcc -E -P test.cpp). I will try to reproduce the > problem with that. I can send you output from (cl /EP /P, that's similar to gcc -E -P) if that would help. (I'd prefer sending it on e-mail instead of attaching it here) (In reply to comment #3) > I'm using headers from MSVC 2005, maybe that's the problem. > In "C/C++ General" -> "Paths and Symbols" -> Includes -> GNU C++ > I'm adding include dir: > MSVC8Location\VC\include Ok, I have an installation of a microsoft compiler on my machine, I'll try to reproduce the issue with its headers. > I can send you output from (cl /EP /P, that's similar to gcc -E -P) > if that would help. > (I'd prefer sending it on e-mail instead of attaching it here) If I cannot reproduce the isse, we can try that. Created attachment 182912 [details]
testcase + fix
Thanks, I can reproduce the issue with the microsoft headers.
Fixed in 8.0 > 20101111. *** cdt cvs genie on behalf of mschorn *** Bug 329795: Resolution of nested typedef specializations. [*] AST2TemplateTests.java 1.199 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java?root=Tools_Project&r1=1.198&r2=1.199 [*] CPPSpecialization.java 1.24 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSpecialization.java?root=Tools_Project&r1=1.23&r2=1.24 *** Bug 333186 has been marked as a duplicate of this bug. *** I was seeing the same issue with Mars.1 when trying to return ->second from a left- or right-side iterator to a Boost.Bimap. When I backed out "second" and hit ctrl+space (and then waited 10-15 seconds) to bring up the content assist list, "second" was listed. When I picked it, the errors went away. I guess CDT doesn't fully untangling the Boost/STL craziness until you engage content assist? I rarely use content assist, because I can't get the list to pop up in under 10 seconds even with everything but parsing suggestions disabled and with indexing of not-in-build source files and unused headers both disabled. |
Build Identifier: eclipse helios 20100917-0705, CDT Version: 8.0.0.201011050851 Build id: 201011050851 The following testcase shows the problem: #include <iostream> #include <list> struct SampleStr { int foo, bar; }; int main(int argc, char** argv) { std::list< SampleStr > structList; std::list< SampleStr >::const_iterator e2 = structList.begin(), _e2 = structList.end(); for (; e2 != _e2; ++ e2) { std::cout << (*e2).foo << std::endl; } for (; e2 != _e2; ++ e2) { std::cout << e2->foo << std::endl; } return 0; } The line with (*e2).foo is underlined as error: "field could not be resolved", although e2->foo seems to be parsed without problem. Reproducible: Always