Skip to content

glm::to_string can't be used with GCC when GLM_FORCE_INLINE is enabled #1455

Description

@dos1
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/glm.hpp>
#include <glm/gtx/string_cast.hpp>
#include <iostream>

int main() {
  glm::vec3 a { 1.0, 2.0, 3.0 };
  std::cout << glm::to_string(a) << std::endl;
  return 0;
}

Compiles fine with g++ test.cpp -o test, but fails with g++ test.cpp -o test -DGLM_FORCE_INLINE=:

In file included from /usr/include/glm/gtx/string_cast.hpp:45,
                 from test.cpp:3:
/usr/include/glm/gtx/string_cast.inl: In function ‘std::string glm::detail::format(const char*, ...)’:
/usr/include/glm/gtx/string_cast.inl:21:40: error: function ‘std::string glm::detail::format(const char*, ...)’ can never be inlined because it uses variable argument lists
   21 |         GLM_FUNC_QUALIFIER std::string format(const char* message, ...) {
      |                                        ^~~~~~

Works fine with clang++ in both cases. Tested on glm 1.0.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions