Summary: | huge number of build warnings: declaration of ‘value’ shadows a member of ‘MyMoneyKeyValueContainer’ [-Wshadow] | ||
---|---|---|---|
Product: | [Applications] kmymoney | Reporter: | Ralf Habacker <ralf.habacker> |
Component: | buildsystem | Assignee: | KMyMoney Devel Mailing List <kmymoney-devel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version First Reported In: | git (master) | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/office/kmymoney/-/commit/a58a6de82a78bac8de71ca41d00931827bbf73f8 | Version Fixed In: | 5.2 |
Sentry Crash Report: |
Description
Ralf Habacker
2024-10-22 18:37:38 UTC
Comment from Thomas Baumgart at https://invent.kde.org/office/kmymoney/-/merge_requests/235#note_1057397 > Why does the name of the argument need to be changed? In case there is a reason, please call it newValue instead of _value. > Rationale: Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace as per C++ specs. > So I recommend to avoid using it in this context (even though it does not conflict as we have no global namespace here). As far as I can see from the source locations at 1. https://invent.kde.org/office/kmymoney/-/blob/master/kmymoney/mymoney/mymoneykeyvaluecontainer.h#L97 /** * convenience method for @c enum */ template<typename T> T value(const QString& key, T defaultValue) const { return static_cast<T>(value(key, static_cast<int>(defaultValue))); } 2. https://invent.kde.org/office/kmymoney/-/blob/master/kmymoney/mymoney/mymoneykeyvaluecontainer.h#L117 /** * convenience method for integral types (except bool) */ template<typename T> void setValue(const QString& key, T value, T defaultValue) { return setValue_int(key, static_cast<int>(value), static_cast<int>(defaultValue)); } the two templates here have a problem. Using a more recent compiler (g++-13, g++-14, clang v17) also solves this issue. Git commit a58a6de82a78bac8de71ca41d00931827bbf73f8 by Thomas Baumgart. Committed on 15/11/2024 at 20:54. Pushed by tbaumgart into branch 'master'. Prevent warning about shadowing a member FIXED-IN: 5.2 M +2 -2 kmymoney/mymoney/mymoneyaccountloan.cpp M +9 -9 kmymoney/mymoney/mymoneykeyvaluecontainer.cpp M +2 -2 kmymoney/mymoney/mymoneykeyvaluecontainer.h https://invent.kde.org/office/kmymoney/-/commit/a58a6de82a78bac8de71ca41d00931827bbf73f8 |