unexpected line break is added to opening-braces in lamda definition.
As previously fixed by https://sourceforge.net/p/astyle/bugs/553/, this is not occur within immediately called lambda.
But, when used break-closing-braces, this occurs again within immediately called lambda.
code:
void func()
{
// if-else in lambda definition
auto b = [] {
if (true) {
return 1;
} else {
return 2;
}
};
// if-else in immediately called lambda
int c = [] {
if (true) {
return 1;
} else {
return 2;
}
}();
}
I ran astye as follows:
$ astyle --version
Artistic Style Version 3.4.6
$ astyle --options=none --style=1tbs sample.cpp
becomes:
@@ -3,9 +3,11 @@ void func()
{
// if-else in lambda definition
auto b = [] {
- if (true) {
+ if (true)
+ {
return 1;
- } else {
+ } else
+ {
return 2;
}
};
I ran astye as follows:
$ astyle --version
Artistic Style Version 3.4.6
$ astyle --options=none --style=1tbs --break-closing-braces sample.cpp
becomes:
@@ -3,9 +3,12 @@ void func()
{
// if-else in lambda definition
auto b = [] {
- if (true) {
+ if (true)
+ {
return 1;
- } else {
+ }
+ else
+ {
return 2;
}
};
@@ -14,7 +17,9 @@ void func()
int c = [] {
if (true) {
return 1;
- } else {
+ }
+ else
+ {
return 2;
}
}();
You can test a fix in the latest git commit.
Fixed in 3.4.8