#define test(x) _Generic(x, int:test_i)(x)
void test_i(int x) {}
int main()
{
int a = 1;
test(a);
return 0;
}
出现了编译错误:
warning: implicit declaration of function ‘_Generic’ [-Wimplicit-function-declaration]
error: expected expression before ‘int’
这是怎么回事?
问题解决了,GCC 4.9 以上版本才支持 _Generic, 而我使用的是 GCC 4.8.2