Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 348170

Summary: Code analysis "Invalid Argument" reports invalid argument which is valid
Product: [Tools] CDT Reporter: Kocka Mising name <kosztkaid>
Component: cdt-indexerAssignee: Project Inbox <cdt-indexer-inbox>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug, kolsrud, malaperle, vkrevs, yevshif
Version: 8.1.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Screen Shoot of the bug none

Description Kocka Mising name CLA 2011-06-03 03:07:30 EDT
Created attachment 197290 [details]
Screen Shoot of the bug

In the following example "result.push_back(*it);" Is marked with "Invalid Argument" by Code analysis.

#include <iostream>
#include <vector>
#include <boost/tokenizer.hpp>
#include <string>
using namespace std;
using namespace boost;

int main() {
	vector<string> result;
	string temp;
	tokenizer<> tokens(temp);
	for (tokenizer<>::const_iterator it = tokens.begin(); tokens.end() != it; ++it) {
		result.push_back(*it);
	}
	return (0);
}
Comment 1 Vadym Krevs CLA 2011-06-20 11:57:13 EDT
I've just tried "Eclipse IDE for C/C++ Developers" from Indigo RC4 on a project, and "code analysis" mistakenly reports many "Method cannot be resolved" errors. Also, Ctrl-click on such methods no longer works either. "Eclipse IDE for C/C++ Developers" from Helios SR2 has no such problems on the same codebase (and Ctrl-click on such methods works just fine in Helios SR2).
Comment 2 Marc-André Laperle CLA 2014-06-25 17:04:59 EDT
(In reply to Kocka Mising name from comment #0)
> Created attachment 197290 [details]
> Screen Shoot of the bug
> 
> In the following example "result.push_back(*it);" Is marked with "Invalid
> Argument" by Code analysis.

This code works fine as of CDT 8.4 (and probably a bit earlier).
Comment 3 Marc-André Laperle CLA 2014-06-25 17:08:34 EDT
(In reply to Missing name from comment #1)
> I've just tried "Eclipse IDE for C/C++ Developers" from Indigo RC4 on a
> project, and "code analysis" mistakenly reports many "Method cannot be
> resolved" errors. Also, Ctrl-click on such methods no longer works either.
> "Eclipse IDE for C/C++ Developers" from Helios SR2 has no such problems on
> the same codebase (and Ctrl-click on such methods works just fine in Helios
> SR2).

The error reporting was new in Indigo but the indexer problems were not new. If you still have problems, you can create a specific bug with sample code to illustrate the problem. Bugs like this are worked on and fixed one by one in separate Bugzilla entries.