I encountered something interesting and annoying while programming a matrix class: internal compiler error. I was willing to invoke a sister constructor in the class called Matrix4<T>::Matrix4(Matrix4<T>&&)
. This is the piece of code that generates this error:
template<typename T>
Matrix4(Matrix4&& matrix_) = default;
template<typename T>
Matrix4<T>::Matrix4(T (&&matrix_)[4][4]):
Matrix4({
.data = {
{matrix_[0][0], matrix_[0][1], matrix_[0][2], matrix_[0][3]},
{matrix_[1][0], matrix_[1][1], matrix_[1][2], matrix_[1][3]},
{matrix_[2][0], matrix_[2][1], matrix_[2][2], matrix_[2][3]},
{matrix_[3][0], matrix_[3][1], matrix_[3][2], matrix_[3][3]}
}
})
{
}
And, this is the internal compiler error (compiler is GCC and IDE is Code::Blocks):
internal compiler error: in process_init_constructor_array, at cp/typeck2.c:1080
Supposedly the compiler cannot successfully parse my code. I'm pretty sure the syntax is alright, though. What can I do in this situation?