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

Selecting GLM_HAS_IF_CONSTEXPR #907

Closed
ryobg opened this issue May 31, 2019 · 1 comment
Closed

Selecting GLM_HAS_IF_CONSTEXPR #907

ryobg opened this issue May 31, 2019 · 1 comment
Milestone

Comments

@ryobg
Copy link

ryobg commented May 31, 2019

GCC 8.x compiles project fixed on C++14

Enabling if constexpr is done by giving priority to the compiler capabilities. Hence, if project has the compiler but is fixed to work on lower standard it will complain. That is, it fails to compile. Example:

../share/glm/gtx/../gtc/../gtc/../gtc/../ext/matrix_transform.inl: In function 'glm::mat<4, 4, T, Q> glm::lookAt(const glm::vec<3, T, Q>&, const glm::vec<3, T, Q>&, const glm::vec<3, T, Q>&)':
../share/glm/detail/setup.hpp:312:31: warning: 'if constexpr' only available with -std=c++17 or -std=gnu++17
 #  define GLM_IF_CONSTEXPR if constexpr
                               ^~~~~~~~~

Reference to the implementation:

#if GLM_HAS_CONSTEXPR
# if (GLM_COMPILER & GLM_COMPILER_CLANG)
#	define GLM_HAS_IF_CONSTEXPR __has_feature(cxx_if_constexpr)
# elif (GLM_COMPILER & GLM_COMPILER_GCC) 
#	define GLM_HAS_IF_CONSTEXPR GLM_COMPILER >= GLM_COMPILER_GCC7
# elif (GLM_LANG & GLM_LANG_CXX17_FLAG)
# 	define GLM_HAS_IF_CONSTEXPR 1
# else
# 	define GLM_HAS_IF_CONSTEXPR 0
# endif
#else
#	define GLM_HAS_IF_CONSTEXPR 0
#endif

#if GLM_HAS_IF_CONSTEXPR
# 	define GLM_IF_CONSTEXPR if constexpr
#else
#	define GLM_IF_CONSTEXPR if
#endif

#if GLM_HAS_CONSTEXPR

@Groovounet
Copy link
Member

This issue should be fixed on master branch for GLM 0.9.9.6 release.

Thanks for reporting,
Christophe

@Groovounet Groovounet added this to the GLM 0.9.9 milestone Sep 7, 2019
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