AStyle built from git 2025-03-21 converts this
std::string test()
{
return R"(
test)" + R"(
test)";
}
into this:
std::string test()
{
return R"(
test)" + R"(
test)";
}
But the content of the raw string literal should never be changed!
using:
--style=allman
--suffix=none
--keep-one-line-blocks
--align-pointer=type
--min-conditional-indent=0
--max-continuation-indent=80
--indent-switches
--indent-col1-comments
--indent-preproc-block
--indent-preproc-define
--pad-header
--pad-comma
--formatted
--lineend=linux
--indent-preproc-block
--convert-tabs
--preserve-ws
I pushed a fix to git
The raw string literals seem to be preserved now, unfortunately there are regressions:
For example the layout of the switch statement in the following test sample is broken (using same astyle config as above):
Another example is the broken layout of the lambda:
Hi, is it possible the bad formatting is triggered by other code before? I cannot replicate your isolated examples (not related to the last change).
The two examples above are "complete" meaning, pasting each of them into a new cpp file and formatting keeps them unchanged (with the Astyle config from above), rather than fixing the broken switch and lambda layouts.
This was tested with your latest version from Jan 30th, freshly compiled from gitlab.
For some reason the presence of the raw string literals is responsible for the layout corruption. When deleting them, both the lambda and switch lay out correctly.
Last edit: Zenju 2026-02-04
It is related to the last line of the raw string having no indent. It seems to be an older bug or regression.
I have comitted another fix.
It works! :) the raw string literals are preserved, and no regressions when applying Astyle to my whole codebase. I'll be using this version onwards. Thank you!
PS: The VS 2022 x64/Static configuration fails to build. IMHO it could be removed entirely if unmaintained, since the effect is apparently like "Release" but with "Multi-threaded (/MT)"
Released in v 3.6.14. I have also adjusted the VS2022 static project option to enable C++17.