内部编译器错误:g ++ 4.3.5的分段错误 [英] Internal compiler error : segmentation fault with g++4.3.5

查看:84
本文介绍了内部编译器错误:g ++ 4.3.5的分段错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是代码

   //fail_.cpp
   template< unsigned char X, class L>
   class A {
      public:
      typedef void (A::*fptr)();
      class B {   
           public: B(typename A< X, L> ::fptr );
      };
   };
   template < unsigned char X, typename L >
   A<X,L>::B::B ( fptr ) { }

g ++ -c fail_.cpp 给出

fail_.cpp:11:内部编译器错误:分段错误
请提交完整的错误报告,如果合适,请使用经过预处理的来源.
参见<文件:///usr/share/doc/gcc-4.3/README.Bugs>获取说明.

fail_.cpp:11: internal compiler error: Segmentation fault
Please submit a full bug report, with preprocessed source if appropriate.
See < file:///usr/share/doc/gcc-4.3/README.Bugs > for instructions.

在我看来,g ++ 4.3.5,g ++ 4.4和更高版本中的错误不会产生任何此类错误.

Looks like a bug to me in g++4.3.5, g++4.4 and higher don't give any such segfault.

你们怎么看?代码本身有问题吗?

What do you guys think? Is there something wrong with the code itself?

推荐答案

我看到gcc 4.2出现了类似的故障.就像其他人所说的那样,内部错误意味着编译器内部发生了严重错误,这不是暗示您的代码是错误的.

I see a similar failure with gcc 4.2. As others have said, an internal error means something went badly wrong inside the compiler, which does not imply that it's your code that was bad.

它在g ++ 4.6和clang 3.0中正常工作.

It works fine in g++ 4.6 and clang 3.0.

这篇关于内部编译器错误:g ++ 4.3.5的分段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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