bug_ms_vec_static.cpp 903 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include <glm/glm.hpp>
  2. #if GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE
  3. struct vec2;
  4. struct swizzleStruct
  5. {
  6. char _buffer[1];
  7. };
  8. struct vec2
  9. {
  10. GLM_CONSTEXPR vec2() :
  11. x(0), y(0)
  12. {}
  13. #if (GLM_COMPILER & GLM_COMPILER_VC)
  14. # pragma warning(push)
  15. # pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
  16. #elif (GLM_COMPILER & GLM_COMPILER_CLANG)
  17. # pragma clang diagnostic push
  18. # pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
  19. # pragma clang diagnostic ignored "-Wnested-anon-types"
  20. #endif
  21. union
  22. {
  23. struct { float x, y; };
  24. struct { swizzleStruct xx; };
  25. };
  26. #if (GLM_COMPILER & GLM_COMPILER_VC)
  27. # pragma warning(pop)
  28. #elif (GLM_COMPILER & GLM_COMPILER_CLANG)
  29. # pragma clang diagnostic pop
  30. #endif
  31. };
  32. #endif
  33. // Visual C++ has a bug generating the error: fatal error C1001: An internal error has occurred in the compiler.
  34. // vec2 Bar;
  35. int main()
  36. {
  37. return 0;
  38. }