silence shadowed variable warnings#593
Conversation
fnc12
left a comment
There was a problem hiding this comment.
please make a PR from dev into dev
| std::get<I>(lhs) = std::move(std::get<I>(rhs)); | ||
| internal::static_if<std::integral_constant<bool, N != I + 1>{}>([](auto &lhs, auto &rhs) { | ||
| move_tuple_impl<N, I + 1>(lhs, rhs); | ||
| internal::static_if<std::integral_constant<bool, N != I + 1>{}>([](auto &l, auto &r) { |
There was a problem hiding this comment.
I thought that shadowing in lambdas does not exist cause outer lhs and rhs do not cross with inner lhs and rhs
There was a problem hiding this comment.
It is a warning in GCC with -Wshadow and in Clang with -Wshadow-all.
It is possible that these warnings are false positives, but they are warnings nonetheless.
It is also possible that a future contributor carelessly adds a & to the lambda capture and then ignores the warnings :)
There was a problem hiding this comment.
I have made the requested changes. I'm also happy to report that all tests pass with the dev branch :)
I hope the fixes can be backported to a tagged release soon, I would like to use a tagged release if possible.
|
Please write changes in sources in |
|
I have run the amalgamation script, but it produced much more changes than I expected. |
fnc12
left a comment
There was a problem hiding this comment.
I've forgot to commit sqlite_orm.h. Please commit it too and then this PR can be merged
| return static_cast<char>(std::toupper(static_cast<int>(c))); | ||
| }); | ||
| static std::array<journal_mode, 6> all = { | ||
| static std::array<journal_mode, 6> all = {{ |
There was a problem hiding this comment.
Because it is a compile error with GCC under the stricter modes I am using.
std::array does not have a constructor that takes an init-list. C++ standard suggests that the second braces can be elided, but the 'official' way is to use two sets of braces.
See https://stackoverflow.com/questions/8192185/using-stdarray-with-initialization-lists
|
I have run the amalgamation script, but it produced more changes than I expected and doesn't compile. [EDIT] |
|
@undisputed-seraphim merged. Thank you! |
This PR aims to get rid of all shadowed variable warnings that occur in GCC during compilation.
Let me know if you would like me to change the naming of some of the changes I proposed.
[EDIT]
It seems that 2 or 3 of the unit tests are failing. It is clearly linked to the shadowed variable names being renamed and the shadowed variables being uncovered now.
I don't really have the willpower to track down exact failing functions, I would appreciate it if anyone can point out to me the offending changes.