Now that we have RANGE_FOR_INIT_STMT we should handle it in cxx_pretty_printer. I don't actually know how to trigger it but it seems straightforward to add.
Bootstrapped/regtested on x86_64-linux, ok for trunk? 2018-09-07 Marek Polacek <pola...@redhat.com> * cxx-pretty-print.c (cxx_pretty_printer::statement) <case RANGE_FOR_SMT>: Handle RANGE_FOR_INIT_STMT. diff --git gcc/cp/cxx-pretty-print.c gcc/cp/cxx-pretty-print.c index df81aa37ce8..8426c7246de 100644 --- gcc/cp/cxx-pretty-print.c +++ gcc/cp/cxx-pretty-print.c @@ -2021,6 +2021,12 @@ cxx_pretty_printer::statement (tree t) pp_cxx_ws_string (this, "for"); pp_space (this); pp_cxx_left_paren (this); + if (RANGE_FOR_INIT_STMT (t)) + { + statement (RANGE_FOR_INIT_STMT (t)); + pp_needs_newline (this) = false; + pp_cxx_whitespace (this); + } statement (RANGE_FOR_DECL (t)); pp_space (this); pp_needs_newline (this) = false;