https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95181

--- Comment #3 from ahmet özhan <tahasuf at gmail dot com> ---
Comment on attachment 48554
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48554
gcc 10 don't compile but clang compile

>#include <array>
>
>namespace math {
>       
>       template <typename T, std::size_t Row, std::size_t Col>
>       requires std::is_arithmetic_v<T>
>       class matrix {
>               union {
>                       std::array<T, Row * Col> m_elements_1d;
>                       std::array<std::array<T, Col>, Row> m_elements_2d;
>               };
>               
>       public:
>               template <typename ...Args>
>               requires
>                       std::conjunction_v<std::is_same<T, Args>...>
>               constexpr matrix(const Args&... args) noexcept
>                       : m_elements_1d {{ args... }} {}
>               
>               template <typename ...Args>
>               requires
>                       std::conjunction_v<std::is_same<std::array<T, Col>, 
> Args>...>
>               constexpr matrix(const Args&... args) noexcept
>                       : m_elements_2d {{ args... }} {}
>       };
>}
>
>#include <iostream>
>
>template <typename T>
>void test() {
>       
>       T f1, f2, f3, f4, f5, f6, f7, f8;
>       
>       std::cin >> f1 >> f2 >> f3 >> f4 >> f5 >> f6 >> f7 >> f8;
>       math::matrix<T, 4, 4> m0(
>               std::array<T, 4> {{ f1, f2, f3, f4 }},
>               std::array<T, 4> {{ f5, f6, f7, f8 }}
>       );
>}
>
>int main(int argc, char **argv)
>{
>       test<float>();
>       return 0;
>}

Reply via email to