我现在使用 Visual Studio 2017 开发程序已有一段时间了。最近我安装了 Clang Power Tool 扩展以检查我的代码质量。我的程序的一部分包括模拟 cpu 的操作码。我在下面创建了一个精简的示例。
以下示例工作正常:
class C{};
inline void andi(C& s);
int main()
{
std::cout << "Hello, world!\n";
}
Run Code Online (Sandbox Code Playgroud)
这个没有:
class C{};
inline void and(C& s);
int main()
{
std::cout << "Hello, world!\n";
}
Run Code Online (Sandbox Code Playgroud)
我在 Clang 3.8.0 上收到这些错误(我在我的程序上使用 9.0.1 版,错误类似):
source_file.cpp:9:18: error: expected ')'
inline void and(C& s);
^
source_file.cpp:9:16: note: to match this '('
inline void and(C& s);
^
source_file.cpp:9:13: error: cannot form a reference to 'void'
inline void and(C& s);
^ …Run Code Online (Sandbox Code Playgroud)