0
我想在尾随类型的自动函数上使用gcc函数属性,但gcc编译器不断拒绝代码。我立足于这里的例子是gcc属性的位置:哪里把gcc函数属性放在自动函数中
https://gcc.gnu.org/onlinedocs/gcc-4.3.5/gcc/Function-Attributes.html
// ok
int my_int_gcc_func()
__attribute__((abi_tag ("tag1") , weak)) //ok
;
// error
auto my_auto_gcc_func_not_working()
__attribute__((abi_tag ("tag2") , weak)) // error
-> int
// cant place attribute here, get different warning..
;
参考文献立即就地属性的功能参数之后。
我发现通过试错,我可以在整个函数声明的前面移动属性关键字,但找不到任何正式的规范说,这是允许/与gcc支持...
// ok
__attribute__((abi_tag ("tag2") , weak)) // seems ok
auto my_auto_gcc_func_no_error()
-> int
;