Skip to content

Fix #11827 FP duplInheritedMember - different return type#5231

Merged
chrchr-github merged 5 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_Fix11827
Jul 12, 2023
Merged

Fix #11827 FP duplInheritedMember - different return type#5231
chrchr-github merged 5 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_Fix11827

Conversation

@chrchr-github
Copy link
Copy Markdown
Collaborator

No description provided.

@chrchr-github
Copy link
Copy Markdown
Collaborator Author

chrchr-github commented Jul 10, 2023

It seems that the functionConst examples "worked" only by accident.

Edit: There was an issue in CheckClass. Still not sure if we should warn for the examples from https://trac.cppcheck.net/ticket/11499
There is no guarantee that const/non-const overloads are interchangeable.
We don't warn for this equivalent code either:

struct A {
	void f() const;
};
template<class T>
struct P {
	T* get();
	const T* get() const;
};
struct S {
	P<A> p;
	void g() { p.get()->f(); }
};

@chrchr-github chrchr-github merged commit c0bd9f8 into cppcheck-opensource:main Jul 12, 2023
@chrchr-github chrchr-github deleted the chr_Fix11827 branch July 12, 2023 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants