Skip to content

Assigning to swizzle fails #786

Open
@hmarthinsen

Description

@hmarthinsen

Compiling this short program fails:

#define GLM_FORCE_SWIZZLE
#define GLM_FORCE_MESSAGES
#include <glm/glm.hpp>

int main()
{
    glm::vec3 a(1, 2, 3);
    glm::vec3 b(4, 5, 6);

    a.xy = b.xy;
}

Here are the error messages:

In file included from /home/hakonm/Programming/modhot-base/thirdparty/glm/glm/detail/setup.hpp:35:0,
                 from /home/hakonm/Programming/modhot-base/thirdparty/glm/glm/glm.hpp:90,
                 from swizzletest.cpp:3:
/home/hakonm/Programming/modhot-base/thirdparty/glm/glm/detail/../simd/platform.h:63:49: note: #pragma message: GLM: Linux platform detected
 #  pragma message("GLM: Linux platform detected")
                                                 ^
In file included from /home/hakonm/Programming/modhot-base/thirdparty/glm/glm/glm.hpp:90:0,
                 from swizzletest.cpp:3:
/home/hakonm/Programming/modhot-base/thirdparty/glm/glm/detail/setup.hpp:42:41: note: #pragma message: GLM: version 0.9.9.1
 # pragma message ("GLM: version 0.9.9.1")
                                         ^
/home/hakonm/Programming/modhot-base/thirdparty/glm/glm/detail/setup.hpp:57:47: note: #pragma message: GLM: GCC compiler detected
 #  pragma message("GLM: GCC compiler detected")
                                               ^
/home/hakonm/Programming/modhot-base/thirdparty/glm/glm/detail/setup.hpp:88:39: note: #pragma message: GLM: 64 bits model
 #  pragma message("GLM: 64 bits model")
                                       ^
/home/hakonm/Programming/modhot-base/thirdparty/glm/glm/detail/setup.hpp:111:46: note: #pragma message: GLM: SSE2 instruction set
 #  pragma message("GLM: SSE2 instruction set")
                                              ^
In file included from /home/hakonm/Programming/modhot-base/thirdparty/glm/glm/glm.hpp:90:0,
                 from swizzletest.cpp:3:
/home/hakonm/Programming/modhot-base/thirdparty/glm/glm/detail/setup.hpp:232:31: note: #pragma message: GLM: C++14
 #  pragma message("GLM: C++14")
                               ^
/home/hakonm/Programming/modhot-base/thirdparty/glm/glm/detail/setup.hpp:567:53: note: #pragma message: GLM: Swizzling operators enabled
 #  pragma message("GLM: Swizzling operators enabled")
                                                     ^
/home/hakonm/Programming/modhot-base/thirdparty/glm/glm/detail/setup.hpp:618:63: note: #pragma message: GLM: Depth clip space: negative one to one
 #  pragma message("GLM: Depth clip space: negative one to one")
                                                               ^
/home/hakonm/Programming/modhot-base/thirdparty/glm/glm/detail/setup.hpp:640:57: note: #pragma message: GLM: Coordinate system: right handed
 #  pragma message("GLM: Coordinate system: right handed")
                                                         ^
/home/hakonm/Programming/modhot-base/thirdparty/glm/glm/detail/setup.hpp:744:108: note: #pragma message: GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification
 #  pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
                                                                                                            ^
In file included from swizzletest.cpp:3:0:
/home/hakonm/Programming/modhot-base/thirdparty/glm/glm/glm.hpp:103:46: note: #pragma message: GLM: Core library included
 # pragma message("GLM: Core library included")
                                              ^
In file included from /home/hakonm/Programming/modhot-base/thirdparty/glm/glm/detail/func_integer.inl:4:0,
                 from /home/hakonm/Programming/modhot-base/thirdparty/glm/glm/integer.hpp:211,
                 from /home/hakonm/Programming/modhot-base/thirdparty/glm/glm/glm.hpp:126,
                 from swizzletest.cpp:3:
/home/hakonm/Programming/modhot-base/thirdparty/glm/glm/detail/../ext/vec1.hpp:27:56: note: #pragma message: GLM: GLM_EXT_vec1 extension included
 # pragma message("GLM: GLM_EXT_vec1 extension included")
                                                        ^
swizzletest.cpp: In function ‘int main()’:
swizzletest.cpp:10:7: error: invalid use of member function ‘glm::vec<2, T, Q> glm::vec<3, T, Q>::xy() const [with T = float; glm::qualifier Q = (glm::qualifier)0u]’ (did you forget the ‘()’ ?)
     a.xy = b.xy;
     ~~^~

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions