"error: expected expression" when compiling from command line but not from Xcode

"error: expected expression" when compiling from command line but not from Xcode

我分别用 clang++ (700.1.76) 和 Xcode 7.1 编译了下面的代码片段。

#include <iostream>
#include <string>

using namespace std;

class Point {
private:
    int x;
    int y;
public:
    Point(int x1 = 0, int y1 = 0) {
        x = x1;
        y = y1;
    }
    string display() {
        return "(" + to_string(x) + ", " + to_string(y) + ")";
    }
};

class Shape {
private:
    Point bottomLeft;
    Point upperRight;
public:
    Shape(Point bottomLeft1, Point upperRight1) {
        bottomLeft = bottomLeft1;
        upperRight = upperRight1;
    }
    Point getBottomLeft() {
        return bottomLeft;
    }
};

int main(int argc, char const *argv[]) {
    Point p1(1, 2);
    Point p2(3, 4);
    Shape s1(p1, p2);
    Shape s2({1, 2}, {3, 4});
    cout << s1.getBottomLeft().display() << endl;
    cout << s2.getBottomLeft().display() << endl;
    return 0;
}

在Xcode中,我得到了

的预期输出
(2, 1)
(2, 1)

但是使用clang++,程序编译失败并抛出这个错误:

test.cpp:38:11: error: expected expression
    Shape s2({1, 2}, {3, 4});
             ^

{3, 4} 也会重复同样的错误。)

这是怎么回事?

调用时需要指定语言标准clang++

显然,任何高于 c++11 的内容都可以。