次のコード:
struct A
{
int f(int);
auto g(int x) -> decltype(f(x));
};
次のエラーでコンパイルに失敗します:
error: cannot call member function 'int B::f(int)' without object
それを次のように変更すると:
struct A
{
int f(int);
auto g(int x) -> decltype(this->f(x));
};
別のエラーが発生します:
error: invalid use of 'this' at top level
これらのいずれかの何が問題になっていますか? gcc 4.6 を使用しています