考虑以下程序:
#include <array>
int main() {
throw std::logic_error("hi");
}
在某些 C++ 编译器(或者更确切地说,标准库)中,这可以编译。例如,libstdc++ 8,其中<array>
包含<stdexcept>
。但在其他标准库实现中,例如 libstdc++ 11,则无法编译。
我能让 clang-tidy 警告我这种情况吗?至少相对于标准库来说?
如果没有 - 是否有其他工具(可能不是基于 clang)可以帮助我检测这个问题?