Cevelop / cevelop

The C++ IDE for professional developers
Eclipse Public License 2.0
5 stars 0 forks source link

constificator: suggests to add const to private member that is used non-const reference parameter in .cpp file #25

Open PeterSommerlad opened 5 years ago

PeterSommerlad commented 5 years ago

see title

tonisuter commented 5 years ago

I was able to reproduce this on the master branch with the following example:

// c.h
#ifndef C_H_
#define C_H_

class C {
    int x;    // x is erroneously marked for constification
public:
    C(const int x) : x { x } { }
    void f();
};

#endif
// c.cpp
#include "c.h"

void increment(int &n) {
    n += 1;
}

void C::f() {
    increment(x);
}