尝试使用GCC8.2.1和CLANG6.0.1编译sqlpp17代码库是一种非常奇怪的体验。代码将编译器推向极限,同时我可能遇到了一些编译器错误。
在GCC文档中,[[可能未使用]]是从版本7开始实现的,但是如果使用这种方式:
struct foo {
foo([[maybe_unused]] bool thing1)
{
}
};
我点击这个特定的错误:
<source>:2:9: error: expected unqualified-id before '[' token
foo([[maybe_unused]] bool thing1)
^
<source>:2:9: error: expected ')' before '[' token
foo([[maybe_unused]] bool thing1)
~^
)
Compiler returned: 1
现在,我对C++ 17知之甚少,不知道这个错误是否正确,我知道CLAN 6编译的那部分很好(并且在其他地方失败)。
那么,谁是对的,Clang还是GCC?(clang和gcc的标志都是-std=gnu++17,由cmake生成)