Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter name shadow warning (includes patch) #114

Closed
rpopescu opened this issue Aug 3, 2015 · 3 comments
Closed

Parameter name shadow warning (includes patch) #114

rpopescu opened this issue Aug 3, 2015 · 3 comments

Comments

@rpopescu
Copy link
Contributor

rpopescu commented Aug 3, 2015

Hi Gabi,

I get a warning in details/format.h where in the ctor of NamedArg the parameter "name" shadows member "name".
This happens with:

$ clang --version
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix

Although the warning does not appear with GCC 4.8.3, it is genuine in my opinion, this simple patch fixes it (changes parameter "name" to "argname"):

Index: include/spdlog/details/format.h
===================================================================
--- include/spdlog/details/format.h (revision 754)
+++ include/spdlog/details/format.h (working copy)
@@ -1127,8 +1127,8 @@
     BasicStringRef<Char> name;

     template <typename T>
-    NamedArg(BasicStringRef<Char> name, const T &value)
-        : name(name), Arg(MakeValue<Char>(value)) {
+    NamedArg(BasicStringRef<Char> argname, const T &value)
+        : name(argname), Arg(MakeValue<Char>(value)) {
         type = static_cast<internal::Arg::Type>(MakeValue<Char>::type(value));
     }
 };
@gabime
Copy link
Owner

gabime commented Aug 3, 2015

Thanks. Please submit pull request to cppformat(https://github.com/cppformat/cppformat) repository. forma.h and format.cc are part of the cppformat

@rpopescu
Copy link
Contributor Author

rpopescu commented Aug 4, 2015

Unfortunately that's not as simple as I thought; the code you're using seems a bit older than the current master of cppformat.
Can you update your local copy?

@rpopescu
Copy link
Contributor Author

rpopescu commented Aug 4, 2015

cppformat pull is fmtlib/fmt#191

@gabime gabime closed this as completed May 19, 2016
gabime added a commit that referenced this issue Jun 4, 2019
bachittle pushed a commit to bachittle/spdlog that referenced this issue Dec 22, 2022
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

No branches or pull requests

2 participants