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

Static_assert failed "incompatible pointer type" with Xcode #751

Closed
KingOfDuck opened this issue Sep 21, 2017 · 4 comments
Closed

Static_assert failed "incompatible pointer type" with Xcode #751

KingOfDuck opened this issue Sep 21, 2017 · 4 comments
Labels
state: please discuss please discuss the issue or vote for your favorite option

Comments

@KingOfDuck
Copy link

I just simply include json.hpp, using Xcode. And this error occurs while building.
Here is the place where the issue appears(3368).
The compiler also says no matching function for call to 'get_impl_ptr' at line 3379.

    3367   // make sure the type matches the allowed types
    3368  static_assert(
    3369      std::is_same<object_t, pointee_t>::value
    3370      or std::is_same<array_t, pointee_t>::value
        or std::is_same<string_t, pointee_t>::value
        or std::is_same<boolean_t, pointee_t>::value
        or std::is_same<number_integer_t, pointee_t>::value
        or std::is_same<number_unsigned_t, pointee_t>::value
        or std::is_same<number_float_t, pointee_t>::value
        , "incompatible pointer type");

    3378        // delegate the call to get_impl_ptr<>()
    3379        return get_impl_ptr(static_cast<PointerType>(nullptr));

Already added -std=c++11.
The compiler is Apple LLVM 8.1.

@KingOfDuck
Copy link
Author

Here are all the outputs of the compiler.

    Semantic Issue Group
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3368:9: Static_assert failed "incompatible pointer type"
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/server.cpp:10:10: In file included from /Users/sandrial/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/server.cpp:10:
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3318:16: In instantiation of function template specialization 'nlohmann::basic_json<std::map, std::vector,                                 std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>::get_ptr<char *, 0>' requested here
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/server.cpp:123:40: In instantiation of function template specialization 'nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>::get<char *, 0>' requested here
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3379:16: No matching member function for call to 'get_impl_ptr'
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/server.cpp:10:10: In file included from /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/server.cpp:10:
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3037:15: Candidate function not viable: no known conversion from 'char *' to 'object_t *' (aka 'map<std::__1::basic_string<char>, nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>, std::less<basic_string<char> >, allocator<std::pair<const basic_string<char>, basic_json<std::map, std::vector, basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer> > > > *') for 1st argument
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3049:14: Candidate function not viable: no known conversion from 'char *' to 'array_t *' (aka 'vector<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>, allocator<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer> > > *') for 1st argument
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3061:15: Candidate function not viable: no known conversion from 'char *' to 'string_t *' (aka 'std::__1::basic_string<char> *') for 1st argument
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3073:16: Candidate function not viable: no known conversion from 'char *' to 'boolean_t *' (aka 'bool *') for 1st argument
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3085:23: Candidate function not viable: no known conversion from 'char *' to 'number_integer_t *' (aka 'long long *') for 1st argument
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3097:24: Candidate function not viable: no known conversion from 'char *' to 'number_unsigned_t *' (aka 'unsigned long long *') for 1st argument
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3109:21: Candidate function not viable: no known conversion from 'char *' to 'number_float_t *' (aka 'double *') for 1st argument
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3043:31: Candidate function not viable: no known conversion from 'char *' to 'const object_t *' (aka 'const map<std::__1::basic_string<char>, nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>, std::less<basic_string<char> >, allocator<std::pair<const basic_string<char>, basic_json<std::map, std::vector, basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer> > > > *') for 1st argument
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3055:30: Candidate function not viable: no known conversion from 'char *' to 'const array_t *' (aka 'const vector<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>, allocator<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer> > > *') for 1st argument
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3067:31: Candidate function not viable: no known conversion from 'char *' to 'const string_t *' (aka 'const std::__1::basic_string<char> *') for 1st argument
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3079:32: Candidate function not viable: no known conversion from 'char *' to 'const boolean_t *' (aka 'const bool *') for 1st argument
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3091:39: Candidate function not viable: no known conversion from 'char *' to 'const number_integer_t *' (aka 'const long long *') for 1st argument
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3103:40: Candidate function not viable: no known conversion from 'char *' to 'const number_unsigned_t *' (aka 'const unsigned long long *') for 1st argument
    /Users/windows/Desktop/qt/Simpleqq/TcpServer/TcpServer/src/json.hpp:3115:37: Candidate function not viable: no known conversion from 'char *' to 'const number_float_t *' (aka 'const double *') for 1st argument

@theodelrieu
Copy link
Contributor

Could you post the code sample? I have an idea already but I prefer to be sure.

@nlohmann nlohmann added the state: please discuss please discuss the issue or vote for your favorite option label Sep 23, 2017
@nlohmann
Copy link
Owner

Any news here?

@nlohmann
Copy link
Owner

nlohmann commented Oct 1, 2017

Closing ticket due to inactivity. Please reopen if needed.

@nlohmann nlohmann closed this as completed Oct 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: please discuss please discuss the issue or vote for your favorite option
Projects
None yet
Development

No branches or pull requests

3 participants