Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » CODAN false positive with push_back
CODAN false positive with push_back [message #1063693] Thu, 13 June 2013 18:33 Go to next message
Maël Cournoyer-Michel is currently offline Maël Cournoyer-MichelFriend
Messages: 1
Registered: June 2013
Junior Member
Here is a simple code snippet that triggers a semantic error by codan, while the code still compiles fine (got to turn c++11 on).

#include <vector>

int test() {

    std::vector<int> v1 = {12, 34};
    std::vector<int> v2 = {56, 78};

    //push_back is underlined red.
    v1.push_back(v2[0]);

    return v1[2];

}


The semantic error is: Invalid arguments ' Candidates are: void push_back(const int &) void push_back(int &&) '.

Any way to fix it, or at least make the error disappear from the problem list?
Re: CODAN false positive with push_back [message #1064559 is a reply to message #1063693] Wed, 19 June 2013 21:33 Go to previous message
Esa Varemo is currently offline Esa VaremoFriend
Messages: 3
Registered: June 2013
Junior Member
I am having a similar problem with:
std::vector<int> *testVector = new std::vector<int>();
testVector->at(0);

The code compiles fine, but eclipse (CODAN?) is complaining:
Invalid arguments '
Candidates are:
int & at(?)
const int & at(?)
'


There propably is something wrong in my settings, as I had to tweak them a bit to get c++11 to compile at all and to remove 90% of the errors it showed.
Previous Topic:android/java/src/pcf: No such file or directory
Next Topic:Can Eclipse ignore CMakeLists.txt
Goto Forum:
  


Current Time: Tue Sep 17 04:52:33 GMT 2024

Powered by FUDForum. Page generated in 0.04409 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top