【发布时间】:2018-09-23 11:17:16
【问题描述】:
我试图编译这段代码(在文件 test.cpp 中)
#include<tuple>
int main(){
auto [c,d] = make_tuple(3.1,2.3);
}
使用
g++ -std=c++17 test.cpp -o test
, 也
clang++ -std=c++1z test.cpp -o test
两者都会打印错误消息:
test.cpp: In function ‘int main()’:
test.cpp:3:7: error: expected unqualified-id before ‘[’ token
auto [c,d] = make_tuple(3.1,2.3);
使用 g++ (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 和 clang 版本 3.8.0-2ubuntu4 (使用 Ubuntu 16.04.09) 我错过了什么?
【问题讨论】:
-
使用更新的版本