-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
template parameter "T" is not used in declaring the parameter types of function template #386
Comments
Hey @MedicineYeh, thanks for the report. I don't exactly remember why I had to add
It may be possible to change the code, but I think that this may break the code on MSVC or any other compiler which made me code it this way in the first place. |
@nlohmann I think changing |
Hi @nlohmann @gregmarr , |
When I make this change diff --git a/src/json.hpp b/src/json.hpp
index 6fed0a12..c0535cea 100644
--- a/src/json.hpp
+++ b/src/json.hpp
@@ -1335,7 +1335,7 @@ class basic_json
template<typename T, typename std::enable_if<
not (std::is_same<T, int>::value) and
std::is_same<T, number_integer_t>::value, int>::type = 0>
- basic_json(const number_integer_t val) noexcept
+ basic_json(const T val) noexcept
: m_type(value_t::number_integer), m_value(val)
{
assert_invariant(); I get this compiler error:
Tried with Apple LLVM version 8.0.0 (clang-800.0.42.1) and g++-6 (Homebrew gcc 6.2.0) 6.2.0. |
Cool, so this work around do make some ambiguity... Seems like my work around is not a good way to fix the warning. Still, the warning is not harmful so I would like to conclude with don't change the type. I have no better idea on fixing this warning. I would consider to send a report to Intel so that they might fix this in the future version. It's really non sense of reporting warning on this peice of code. |
I think we can close this issue, right? |
To follow-up, |
Cool. Thanks everyone. |
@TurpentineDistillery also possible on the command line with |
Hello,
I tried different compilers with this super great repo. Both GCC and Clang can compile it without any warning and error. However, due to some unknown issue, Intel ICC seems to implement this template declaration check differently.
Here is the warning message I got when I compile with the
icpc (ICC) 16.0.3 20160415
.I found a way to walk around it, which is using the template type instead of using the specific type on line 1338 and 1433.
Here is my walk around (I only change number_integer_t to T):
Line 1433 is the same thing.
The text was updated successfully, but these errors were encountered: