Bug 559737 - False positive in C++ code analysis in container initilization with iterators when using namespace std
Summary: False positive in C++ code analysis in container initilization with iterators...
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: Next   Edit
Hardware: All Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords: core, regression, ui, usability
Depends on:
Blocks:
 
Reported: 2020-01-31 04:47 EST by Halit Ongen CLA
Modified: 2020-02-01 02:53 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Halit Ongen CLA 2020-01-31 04:47:40 EST
-- Configuration Details --
Product: Eclipse IDE 4.14.0.20191212-1200 (org.eclipse.epp.package.cpp.product)Installed Features:
 org.eclipse.platform 4.14.0.v20191210-0610

False positive in C++ code analysis. An error is presented as a red underline when a container is assigned to a container of the same type initialized with iterators. The code compiles and runs as intended. Reproducible in a clean install in both Linux and Mac. Example:

#include <vector>

using namespace std;

int main(void) {
	vector <int> foo(5,1);                                                                                                      //No error
	vector <int> bar(foo.begin(),foo.end());                                                                         //No error
	vector <int> cpp11 = {1,2,3,4,5};                                                                                  //No error
	vector <int> whyIsThisAnError = vector <int> (foo.begin(),foo.end());                       //ERROR
	vector <int> whyIsntThisAnError = std::vector <int> (foo.begin(),foo.end());             //No error
	return 0;
}
Comment 1 Marco Stornelli CLA 2020-02-01 02:53:39 EST
Reassigned to parser component since Codan checker just reports problem bindings, nothing more.