Skip to content

Commit 923e0f3

Browse files
committed
Preserve paren state across print_to_string call, addresses #256
1 parent bad1903 commit 923e0f3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

source/cppfront.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,9 +1373,16 @@ class cppfront
13731373
auto... more
13741374
)
13751375
{
1376+
// Quick special-purpose preservation of need_* state... right now it's
1377+
// only needed here so the tactical fix is fine, but if it's needed
1378+
// elsewhere then generalize this
1379+
auto state = need_expression_list_parens;
1380+
13761381
printer.emit_to_string(str);
13771382
emit(i, more...);
13781383
printer.emit_to_string();
1384+
1385+
need_expression_list_parens.swap(state); // restore the state
13791386
};
13801387

13811388
auto print_to_string(

0 commit comments

Comments
 (0)