以下代码可以使用g++ 4.7.1进行编译,但不能使用clang 3.1进行编译
struct A
{
int foo();
};
int A::foo() __restrict
{
return 0;
}
int main(int argc, char * argv[])
{
A a;
return a.foo();
}clang支持__restrict吗?或者它使用了特定的语法?
发布于 2012-10-06 11:02:38
我手头上没有clang 3.1,但是在clang 4.1下,我得到了这个错误:
t.cpp:6:8: error: out-of-line definition of 'foo' does not match any declaration
in 'A'
int A::foo() __restrict
^~~
t.cpp:3:7: note: member declaration nearly matches
int foo();
^
1 error generated.如果我将A::foo的声明更改为以下内容,Clang4.1将成功编译它:
int foo() __restrict;https://stackoverflow.com/questions/12756299
复制相似问题