rttrorg / rttr

C++ Reflection Library
https://www.rttr.org
MIT License
3.12k stars 430 forks source link

Failing to compile rttr::type::get<glm::mat2>() on GCC #296

Open aaalexandrov opened 3 years ago

aaalexandrov commented 3 years ago

The implementation of get_template_arguments() in rttr/detail/misc/template_type_trait_impl.h is inconsistent between the <T1,N1> and <T1,N1,N2> cases - <T1,N1> returns { ::rttr::type::get<T1>(), ::rttr::type::get<value_type>() }, i.e. returns type::get<int>() for N1 while <T1,N1,N2> returns { ::rttr::type::get<T1>(), ::rttr::type::get<N1>(), ::rttr::type::get<N2>() }, i.e. is trying to return type::get<2>() for N1 and N2, which fails. Changing the implementation of the 3 parameter cases to be like the 2 parameter case fixes compilation, but I'm not even sure what get_template_arguments() is supposed to return for scalar value parameters, since a value can't be directly encoded as type::get<N>() as normal types are. On MSVC 2017/2019 rttr::type::get<glm::mat2>() compiles, but get_template_arguments() returns an empty array.