gccでのテンプレートクラスの継承
Modern C++をかじったりするとやりたくなりがちなテンプレート継承なのだが、gccではこんなエラーが出る場合がある。
# template<class T> # class Loader : public Base<T> # でBase<T>::hogeをコールしているところで error: there are no arguments to ‘hoge’ that depend on a template pa rameter, so a declaration of ‘hoge’ must be available error: (if you use ‘-fpermissive’, G++ will accept your code, but a llowing the use of an undeclared name is deprecated)
エラーメッセージに従って-fpermissiveオプションを付けて通していた(警告が出るようになる)が、もっといい方法発見。
http://rpgincpp.cocolog-nifty.com/blog/2006/02/post_0123.html
this->hoge()
としたら問題なくなった。
ちなみにvcでは素で通る。