Commit 346956eff19f9d815c6daf06374b5fa5b1bb2a5e
1 parent
2015a743
Fix overly strict shadows in GCC 4.9
Fixes #86. Rename some variables so that the overly strict shadows warning on GCC 4.9 is not triggered.
Showing
2 changed files
with
11 additions
and
7 deletions
CHANGELOG.md
| @@ -15,6 +15,10 @@ options. The project adheres to semantic versioning. | @@ -15,6 +15,10 @@ options. The project adheres to semantic versioning. | ||
| 15 | * Fixed an ambiguous overload in the `parse_positional` function when an | 15 | * Fixed an ambiguous overload in the `parse_positional` function when an |
| 16 | `initializer_list` was directly passed. | 16 | `initializer_list` was directly passed. |
| 17 | 17 | ||
| 18 | +### Bug Fixes | ||
| 19 | + | ||
| 20 | +* Building against GCC 4.9 was broken due to overly strict shadow warnings. | ||
| 21 | + | ||
| 18 | ## 2.0 | 22 | ## 2.0 |
| 19 | 23 | ||
| 20 | ### Changed | 24 | ### Changed |
include/cxxopts.hpp
| @@ -902,13 +902,13 @@ namespace cxxopts | @@ -902,13 +902,13 @@ namespace cxxopts | ||
| 902 | public: | 902 | public: |
| 903 | OptionDetails | 903 | OptionDetails |
| 904 | ( | 904 | ( |
| 905 | - const std::string& short_name, | ||
| 906 | - const std::string& long_name, | 905 | + const std::string& short_, |
| 906 | + const std::string& long_, | ||
| 907 | const String& desc, | 907 | const String& desc, |
| 908 | std::shared_ptr<const Value> val | 908 | std::shared_ptr<const Value> val |
| 909 | ) | 909 | ) |
| 910 | - : m_short(short_name) | ||
| 911 | - , m_long(long_name) | 910 | + : m_short(short_) |
| 911 | + , m_long(long_) | ||
| 912 | , m_desc(desc) | 912 | , m_desc(desc) |
| 913 | , m_value(val) | 913 | , m_value(val) |
| 914 | , m_count(0) | 914 | , m_count(0) |
| @@ -1038,9 +1038,9 @@ namespace cxxopts | @@ -1038,9 +1038,9 @@ namespace cxxopts | ||
| 1038 | class KeyValue | 1038 | class KeyValue |
| 1039 | { | 1039 | { |
| 1040 | public: | 1040 | public: |
| 1041 | - KeyValue(std::string key, std::string value) | ||
| 1042 | - : m_key(std::move(key)) | ||
| 1043 | - , m_value(std::move(value)) | 1041 | + KeyValue(std::string key_, std::string value_) |
| 1042 | + : m_key(std::move(key_)) | ||
| 1043 | + , m_value(std::move(value_)) | ||
| 1044 | { | 1044 | { |
| 1045 | } | 1045 | } |
| 1046 | 1046 |