GCC v4.8.2 でバグを見つけたかもしれませんが、送信する前にまず確認したいのですが、何か間違っている可能性があります。
次のコード:
#include <vector>
struct Message
{
typedef union {
char byte;
const char *str;
} Parameter;
Parameter p1;
Parameter p2;
};
int main()
{
std::vector<Message> messages_;
messages_.push_back({{ .byte = 'a' }});
Message message = {{ .byte = 'a' }, { .str = "Hello World" }};
messages_.push_back(message);
messages_.push_back({{ .byte = 'a' }, { .str = "Hello World" }});
}
clang++ -std=c++11 main.cpp
これをうまくコンパイルします。ただしg++
、これを出力します:
main.cpp: In function ‘int main()’:
main.cpp:23:66: internal compiler error: in reshape_init_class, at cp/decl.c:5216
messages_.push_back({{ .byte = 'a' }, { .str = "Hello World" }});
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccrf5vwr.out file, please attach this to your bugreport.
誰もアイデアを持っていない場合は、これをバグとして提出しますが、私の経験では、プログラマーの問題がコンパイラーのバグであることはほとんどなく、ほとんどの場合、プログラマー自身のせいです!