我遇到了一个非常奇怪的错误,只有在我使用ansi
旗帜时才弹出.
#include <memory>
class Test
{
public:
explicit Test(std::shared_ptr<double> ptr) {}
};
Run Code Online (Sandbox Code Playgroud)
这是使用gcc 4.5.2和4.6.0(20101127)测试的编译:
g++ -std=c++0x -Wall -pedantic -ansi test.cpp
test.cpp:6:34: error: expected ')' before '<' token
Run Code Online (Sandbox Code Playgroud)
但编译没有-ansi
工作.为什么?