I'm using Windows 10, Visual Studio 2017 v15.7.1 with /std:c++latest /permissive-
This simple code with structured bindings won't compile:
auto [a, b] = func1(x, y, z); // auto func1() -> std::tuple<double, double, double>
[a, b] = func2(x, y, z); // same signature as func2
saying E1277 attributes are not allowed here
.
Code below won't compile either, same error
double a, b;
[a, b] = func1(x, y, z);
[a, b] = func2(x, y, z);
Code
auto [a, b] = func1(x, y, z);
auto [a, b] = func2(x, y, z);
won't compile as well, rightfully complaining about redefinition.
The only way it compiles is
auto [a1, b1] = func1(x, y, z);
auto [a2, b2] = func2(x, y, z);
which is, frankly, ugly.
Is this feature designed that way? Or is it VC++ bug?