compiler-bug

    9熱度

    2回答

    在C11,下面的結構工作的一個錯誤: struct S { unsigned a : 4; _Bool b : 1; }; 獲取由GCC奠定了由此使用4位的unsigned(4字節),接着是_Bool (4字節),其中使用1位,總大小爲8字節。 請注意,C99和C11明確允許_Bool作爲位域成員。在C11標準(也可能是C99太)也正在§6.7.2.1「結構和聯合說明」¶

    7熱度

    2回答

    namespace X { void* operator new (size_t); } 給出錯誤消息: error: ‘void* X::operator new(size_t)’ may not be declared within a namespace 它是一個gcc compiler bug?在較舊的gcc版本中,它似乎正在工作。 任何想法,爲什麼不允許? 使用案例

    3熱度

    4回答

    下面的代碼片段失敗,Visual Studio 2010中編譯,但GCC喜歡它: namespace Test { class Baz; // Adding class Bar; here and removing the class below makes it work // with VC++, but it should work like this, sho

    6熱度

    2回答

    我最近撕毀我的頭髮,調試這一段代碼(稍加修改簡化表示): char *packedData; unsigned char* indexBegin, *indexEnd; int block, row; // +------ bad! // v int cRow = std::upper_bound(indexBegin, indexEnd, row&255) - indexBe

    4熱度

    3回答

    這編譯出VS 2009中的問題嗎?我是愚蠢的嗎? GCC發出警告,該模板是私人的....? 我錯過了什麼? #include <iostream> using namespace std; class A { private: template<typename T> A& operator<<(const T & v) { cout << v

    1熱度

    2回答

    我有這個條件了一個錯誤: while(CurrentObserverPathPointDisplacement > lengthToNextPoint && CurrentObserverPathPointIndex < (PathSize - 1)) { CurrentObserverPathPointIndex = CurrentObserverPathPointIndex + 1

    2熱度

    1回答

    我遇到了gcc內聯asm語句的問題;海灣合作委員會似乎認爲結果是一個常數(事實並非如此),並優化了聲明。我認爲我正確使用操作數約束,但想就此事發表第二意見。如果問題不在我使用的約束中,我會嘗試隔離gcc錯誤報告的測試用例,但這可能很困難,因爲即使周圍代碼的微妙變化也會導致問題消失。 有問題的內聯彙編是 static inline void ularith_div_2ul_ul_ul_r (uns

    2熱度

    1回答

    微軟(R)F#2.0互動打造4.0.40219.1 我試圖定義新的記錄類型: type TestOptions = { perRunGC : bool; collectGCStat : bool; } 一切都很好,但讓我們增加一個字段: type TestOptions = { perRunGC : bool; collectGCStat :

    3熱度

    1回答

    我想寫像下面 #include <type_traits> #include <string> struct test{}; namespace ns { struct test{}; } template<typename T> struct arg_wrapper; template<> struct arg_wrapper<test> { arg

    2熱度

    1回答

    class __declspec(dllexport) DI_1 { DI_1& operator = (DI_1 &){}; }; class DI_2 { DI_2& operator = (DI_2 &){}; }; int main() { DI_1 a; DI_2 b; return 0; } 當VS 2010/2