示例代碼如下:結構模板類
struct TEMP
{
int j;
TEMP()
{
j = 0;
}
};
template<typename T>
class classA
{
struct strA
{
long i;
strA():i(0) {}
};
static strA obj_str;
classA();
};
template<typename T>
classA<T>::classA()
{}
template<typename T>
classA<TEMP>::strA classA<TEMP>::obj_str;
int main()
{
return 0;
}
在編譯的代碼,我收到以下錯誤:
test1.cpp:32: internal compiler error: in import_export_decl, at cp/decl2.c:1970 Please submit a full bug report, with preprocessed source if appropriate. See http://bugzilla.redhat.com/bugzilla> for instructions. Preprocessed source stored into /tmp/ccUGE0GW.out file, please attach this to your bugreport.
我建立在x86_64的,紅帽Linux的機器驗證碼,並且gcc版本是gcc版本4.1.2 20070626(Red Hat 4.1.2-14)
請注意此代碼已經使用gcc 3.4.5版20051201(Red Hat 3.4.5-2)在i386- redhat-linux機器。
任何想法,爲什麼這是無法與海灣合作委員會4.1.2建立。
在此先感謝。
您提交了一份完整的錯誤報告嗎?這就是錯誤告訴你要做的事情。您現在可以嘗試使用不同的編譯器[版本]。 – strager 2009-09-30 10:42:24
在這裏發現了一個錯誤報告:http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24791 - 這看起來像是一個變種。 – 2009-09-30 10:57:26
內部編譯器錯誤總是意味着編譯器有問題,所以不要認爲這是你的錯。 – 2009-09-30 10:57:54