2012-11-20 87 views
0

我試圖編譯依賴於稀疏0.4.1項目,但在試圖編譯稀疏0.4.1我結束了以下編譯器錯誤:編譯稀疏0.4.1

included from parse.c:25: 
./parse.h:63:22: error: member of anonymous struct redeclares 'label_statement' 
         struct statement *label_statement; 
             ^
./parse.h:40:22: note: previous declaration is here 
         struct statement *label_statement; 

這我感到困惑,因爲他們是兩個不同結構的不同成員,所以爲什麼會抱怨呢?

的代碼看起來是這樣的:

struct statement { 
    enum statement_type type; 
    struct position pos; 
    union { 
      struct /* declaration */ { 
        struct symbol_list *declaration; 
      }; 
      struct /* label_arg */ { 
        struct symbol *label; 
        struct statement *label_statement; 
      }; 
      struct { 
        struct expression *expression; 
        struct expression *context; 
      }; 
      struct /* return_statement */ { 
        struct expression *ret_value; 
        struct symbol *ret_target; 
      }; 
      struct /* if_statement */ { 
        struct expression *if_conditional; 
        struct statement *if_true; 
        struct statement *if_false; 
      }; 
      struct /* compound_struct */ { 
        struct statement_list *stmts; 
        struct symbol *ret; 
        struct symbol *inline_fn; 
        struct statement *args; 
      }; 
      struct /* labeled_struct */ { 
        struct symbol *label_identifier; 
        struct statement *label_statement; 
      }; 
....... 
+0

什麼編譯器?輸出看起來有點像GCC,但AFAIK新的GCC接受匿名工會成員。你使用的是什麼版本的編譯器,什麼編譯器和什麼'CFLAGS'? – 0xC0000022L

回答

1

聲明的聲明label_statement同一聯盟中的兩次,在第40行的第一和線路63

 struct statement *label_statement; 

嘗試Seconde系列編輯第二個的名稱。