Hello,
AStyle seems to be confused by lambda functions with explicit return type. It doesn't follow the expected "curly bracket policy" inside the lambda body. Additionally I think the ->
notation should be treated as an operator and padded accordingly but that's arguable I guess.
Attached are a sample source file and the configuration file that can be used to reproduce.
Best regards,
Underground78
This issue has not been fixed yet.
I've only just been able to start developing with c++11/17 and so I've just been wondering why VS2017 keeps formatting my code wrongly.
There is no problem in this case:
namespace foo {
auto INST = { return false; };
class bar {};
}
In this case the second lambda is messy and class bar is no longer indented:
namespace foo {
auto INST = { return false; };
auto INST2 = -> bool {
if(a == 0) { return true; }
return false;
};
class bar {};
}
I expected the second snippet to be formatted like this:
namespace foo {
auto INST = { return false; };
auto INST2 = -> bool {
if(a == 0) { return true; }
return false;
};
class bar {};
}
Last edit: Andrew Wall 2017-11-20
This was fixed in a recent release.