我遇到了一个非常奇怪的错误,只有在我使用ansi
标志时才会弹出。
#include <memory>
class Test
{
public:
explicit Test(std::shared_ptr<double> ptr) {}
};
这是使用 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
但是编译没有-ansi
工作。为什么?