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

vec4 constructor is not constexpr #783

Closed
therocode opened this issue Jun 25, 2018 · 1 comment
Closed

vec4 constructor is not constexpr #783

therocode opened this issue Jun 25, 2018 · 1 comment
Assignees
Labels
Milestone

Comments

@therocode
Copy link

out of these 4, all work except the vec4 one, which complains:
error: call to non-constexpr function 'glm::vec<4, T, Q>::vec(T, T, T, T) [with T = float; glm::qualifier Q = (glm::qualifier)0]

static_assert(glm::vec1(1.0f).x > 0.0f);
static_assert(glm::vec2(1.0f, 1.0f).x > 0.0f);
static_assert(glm::vec3(1.0f, 1.0f, 1.0f).x > 0.0f);
static_assert(glm::vec4(1.0f, 1.0f, 1.0f, 1.0f).x > 0.0f);

https://godbolt.org/g/AGD3k1

@Groovounet
Copy link
Member

This issue should be fixed in master branch and GLM 0.9.9.1 release.

The behavior is that constexpr will be consistent across all types. If the project has automatic SIMD code generation, GLM will try to produce code with SIMD instructions which is imcompatible with constexpr. As a result you will need to use GLM_FORCE_PURE to disable SIMD instructions.

Thanks,
Christophe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants