friendとgccのバージョン
研究で使うプログラムがgcc-3.4.3ではコンパイルできないが、4.2.0ではコンパイルできるらしいとわかり、gcc-4.3.0をコンパイルしてみている。あたらしいほうがいいかなって(ぉ
問題となったのはfriendクラスの部分。おおまかには次のようなコード。
class B; class A { friend class B; private: int flag; }; class B { private: struct C { int count; C (const A& arg) : count(arg.flag) {}; }; };
$ gcc -c friend.cc friend.cc: In constructor `B::C::C(const A&)': friend.cc:5: error: `int A::flag' is private friend.cc:11: error: within this context
flagはprivateだと怒られる。まぁそうだろうと思う。
しかしgcc-4.2.0では通るということは、問題なくなったのだろうか。今はまだ手元に4系のgccが無いので確かめられない。
コンパイラのコンパイルはやっぱり時間かかるなぁ。