C ++ - 可以做什么内部编译器错误? [英] C++ - What can be done with internal compiler errors?

查看:209
本文介绍了C ++ - 可以做什么内部编译器错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编程矩阵类时,我遇到了一些有趣和恼人的事情:内部编译器错误。我愿意调用 Matrix4< T> :: Matrix4(Matrix4< T>&&&&&&&&&这是产生此错误的代码段:

  template< typename T> 
Matrix4(Matrix4&& matrix_)= default;

template< typename T>
Matrix4< T> :: Matrix4(T(&& amp; matrix _)[4] [4]):
Matrix4({
.data = {
{matrix_ [ 0] [0],矩阵_ [0] [1],矩阵_ [0] [2],矩阵_ [0] ] matrix_ [2] [0],matrix_ [2] [1],matrix_ [2] [2],matrix_ [1] [2] 2] [3]},
{matrix_ [3] [0],matrix_ [3] [1],matrix_ [3] [2],matrix_ [3] b $ b})
{

}

这是内部编译器错误(编译器是GCC和IDE是Code :: Blocks ):


错误:in process_init_constructor_array,at
cp / typeck2.c:1080


假定编译器无法成功解析我的代码。我很确定的语法是好的,虽然。在这种情况下我可以做什么?

解决方案

尝试使用不同的编译器编译。有可能是你的代码有一个非常微妙的错误,另一个编译器可能能够告诉你更多。我建议您尝试俚语,因为它已被广泛宣传拥有更好的错误消息,尽管最新版本的GCC正在寻求改变这个概念。



如果两个编译器都失败,没有一个真正的错误信息,那么你有一些最好的测试代码为这个bug,在您的处置和提交一个错误报告将由编译器社区非常感谢。 p>

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?

解决方案

Try compiling it with a different compiler. It's possible that there is a very subtle error with your code, and another compiler might be able to tell you more. I recommend trying out Clang, as it has widely been touted for having better error messages, though the most recent versions of GCC are seeking to change this notion.

If it fails on both compilers without a real error message in sight, then you have some of the finest test-code for this bug at your disposal and submitting a bug report about it would be much appreciated by the compiler community.

这篇关于C ++ - 可以做什么内部编译器错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆