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

Build erros with clang #22

Closed
StellaSmith opened this issue Apr 12, 2021 · 1 comment
Closed

Build erros with clang #22

StellaSmith opened this issue Apr 12, 2021 · 1 comment

Comments

@StellaSmith
Copy link
Contributor

I'm getting various implicit conversion errors with clang when emplacing entities. Most of the errors are because integers literals are used to construct an edyn::scalar member.
Still, i found it very weird when conversion warnings shouldn't be treated as errors.

Here's an example:

[15/91] Building CXX object _deps/edyn-build/CMakeFiles/Edyn.dir/src/edyn/collision/narrowphase.cpp.o
FAILED: _deps/edyn-build/CMakeFiles/Edyn.dir/src/edyn/collision/narrowphase.cpp.o 
/usr/bin/clang++ -DEDYN_DISABLE_ASSERT -DENTT_DISABLE_ASSERT -I_deps/edyn-src/include -I_deps/edyn-build/include -I_deps/entt-src/src -O3 -DNDEBUG -Wall -Wno-reorder -Wno-long-long -Wimplicit-fallthrough -std=gnu++17 -MD -MT _deps/edyn-build/CMakeFiles/Edyn.dir/src/edyn/collision/narrowphase.cpp.o -MF _deps/edyn-build/CMakeFiles/Edyn.dir/src/edyn/collision/narrowphase.cpp.o.d -o _deps/edyn-build/CMakeFiles/Edyn.dir/src/edyn/collision/narrowphase.cpp.o -c _deps/edyn-src/src/edyn/collision/narrowphase.cpp
In file included from _deps/edyn-src/src/edyn/collision/narrowphase.cpp:1:
In file included from _deps/edyn-src/include/edyn/collision/narrowphase.hpp:6:
In file included from _deps/entt-src/src/entt/entity/registry.hpp:21:
In file included from _deps/entt-src/src/entt/entity/group.hpp:12:
In file included from _deps/entt-src/src/entt/entity/pool.hpp:6:
_deps/entt-src/src/entt/entity/storage.hpp:365:38: error: non-constant-expression cannot be narrowed from type 'int' to 'edyn::scalar' (aka 'float') in initializer list [-Wc++11-narrowing]
            instances.push_back(Type{std::forward<Args>(args)...});
                                     ^~~~~~~~~~~~~~~~~~~~~~~~
_deps/entt-src/src/entt/entity/registry.hpp:64:46: note: in instantiation of function template specialization 'entt::storage<entt::entity, edyn::contact_point, void>::emplace<std::array<entt::entity, 2> &, const edyn::vector3 &, const edyn::vector3 &, const edyn::vector3 &, int, int, int, const float &>' requested here
            storage<entity_type, Component>::emplace(entt, std::forward<Args>(args)...);
                                             ^
_deps/entt-src/src/entt/entity/storage.hpp:365:38: note: insert an explicit cast to silence this issue
            instances.push_back(Type{std::forward<Args>(args)...});
                                     ^~~~~~~~~~~~~~~~~~~~~~~~
                                     static_cast<scalar>(    )
_deps/entt-src/src/entt/entity/storage.hpp:365:38: error: non-constant-expression cannot be narrowed from type 'int' to 'edyn::scalar' (aka 'float') in initializer list [-Wc++11-narrowing]
            instances.push_back(Type{std::forward<Args>(args)...});
                                     ^~~~~~~~~~~~~~~~~~~~~~~~
_deps/entt-src/src/entt/entity/storage.hpp:365:38: note: insert an explicit cast to silence this issue
            instances.push_back(Type{std::forward<Args>(args)...});
                                     ^~~~~~~~~~~~~~~~~~~~~~~~
                                     static_cast<scalar>(    )
_deps/entt-src/src/entt/entity/storage.hpp:365:38: error: non-constant-expression cannot be narrowed from type 'int' to 'uint32_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
            instances.push_back(Type{std::forward<Args>(args)...});
                                     ^~~~~~~~~~~~~~~~~~~~~~~~
_deps/entt-src/src/entt/entity/storage.hpp:365:38: note: insert an explicit cast to silence this issue
            instances.push_back(Type{std::forward<Args>(args)...});
                                     ^~~~~~~~~~~~~~~~~~~~~~~~
                                     static_cast<uint32_t>(  )
3 errors generated.
@xissburg
Copy link
Owner

I am also using clang and ain't having that issue. Looks like that is happening here

auto &cp = registry.emplace<contact_point>(
. Perhaps using edyn::scalar{0} instead of just 0 would fix the issue.

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