【发布时间】:2012-06-18 23:42:28
【问题描述】:
示例(编译良好)
struct A
{
void f() {};
auto g() -> decltype(f())
{}
};
问题
如果我在 decltype 中添加 this 指针(即decltype(this->f())),我会在 gcc 4.7.0 中得到以下编译错误:
error: invalid use of incomplete type 'struct A'
error: forward declaration of 'struct A'
error: invalid use of incomplete type 'struct A'
error: forward declaration of 'struct A'
不允许在 decltype 中使用this 吗?有人可以帮助我了解问题所在吗?
编辑
【问题讨论】: