#include <vector>
class A
{
std::vector<int> vec;
void swap( A & other) noexcept(noexcept(vec.swap(other.vec)))
{
vec.swap(other.vec);
}
};
int main()
{
}
此代码在 clang(3.4) 下编译,但不在 gcc (4.7.1) 下编译。谁能告诉我我做错了什么?
编辑
gcc 错误信息是:
error: invalid use of incomplete type ‘class A’
error: forward declaration of ‘class A’